/* * SPDX-FileCopyrightText: syuilo and other misskey contributors * SPDX-License-Identifier: AGPL-3.0-only */ export interface IMaybe { isJust(): this is IJust; } export interface IJust extends IMaybe { get(): T; } export function just(value: T): IJust { return { isJust: () => true, get: () => value, }; } export function nothing(): IMaybe { return { isJust: () => false, }; }