UNPKG

988 BTypeScriptView Raw
1import { Actor, ActorOptions, AnyActorLogic, Observer, SnapshotFrom, type ConditionalRequired, type IsNotNever, type RequiredActorOptionsKeys } from 'xstate';
2export declare function useIdleActorRef<TLogic extends AnyActorLogic>(logic: TLogic, ...[options]: ConditionalRequired<[
3 options?: ActorOptions<TLogic> & {
4 [K in RequiredActorOptionsKeys<TLogic>]: unknown;
5 }
6], IsNotNever<RequiredActorOptionsKeys<TLogic>>>): Actor<TLogic>;
7export declare function useActorRef<TLogic extends AnyActorLogic>(machine: TLogic, ...[options, observerOrListener]: IsNotNever<RequiredActorOptionsKeys<TLogic>> extends true ? [
8 options: ActorOptions<TLogic> & {
9 [K in RequiredActorOptionsKeys<TLogic>]: unknown;
10 },
11 observerOrListener?: Observer<SnapshotFrom<TLogic>> | ((value: SnapshotFrom<TLogic>) => void)
12] : [
13 options?: ActorOptions<TLogic>,
14 observerOrListener?: Observer<SnapshotFrom<TLogic>> | ((value: SnapshotFrom<TLogic>) => void)
15]): Actor<TLogic>;