@benev/slate
Version:
frontend web stuff
16 lines (15 loc) • 657 B
TypeScript
import { Op } from "../op/op.js";
import { Signal } from "./signal.js";
export declare class OpSignal<V> extends Signal<Op.For<V>> {
#private;
constructor(op: Op.For<V>);
load(fn: () => Promise<V>): Promise<V>;
setLoading(): void;
setError(reason: string): void;
setReady(payload: V): void;
isLoading(): this is Signal<Op.Loading>;
isError(): this is Signal<Op.Error>;
isReady(): this is Signal<Op.Ready<V>>;
get payload(): (this extends Signal<Op.Ready<V>> ? V : this extends Signal<Op.Loading> ? undefined : this extends Signal<Op.Error> ? undefined : V | undefined);
select<R>(choices: Op.Choices<V, R>): R;
}