Type Aliases Any Func Any Func: ( ( ... args: any [] ) => any )
Atom Atom
< T > : GetFn < T > & { error
: any ; get
: GetFn < T > ; key
: string | undefined ; loading
: boolean ; state
: T ; task
: Promise < T > | undefined ; abort
: any ; on
: any ; reset
: any ; snapshot
: any } Type Parameters Atom Error Event Atom Error Event: { error: any ; rollback: any }
Type declaration error: any rollback: function Atom Extra Props Atom Extra Props< THelpers > : { [ key in keyof THelpers ] : THelpers [ key ] extends ( ( context: any , ... args: infer A) => infer R) ? ( ( ... args: A ) => R ) : never }
Type Parameters Atom Family Atom
Family
< A , T > : { clear
: any ; delete
: any ; forEach
: any ; get
: any ; has
: any } & ( T extends UpdatableAtom < infer V
> ? { set
: SetFn < V > } : {} ) Type Parameters Atom Helpers Atom Helpers< T > : {}
Type Parameters Type declaration [ key: string ]: ( ( context: T , ... args: any [] ) => any ) ( context: T , ... args: any [] ) : any Parameters context: T Rest ... args: any [] Returns any Atom Options Atom Options: { key?: string ; onChange?: VoidFunction ; onLoading?: VoidFunction ; load?: any ; onError?: any ; save?: any }
Type declaration Optional key?: string Optional on Change?: VoidFunction Optional on Loading?: VoidFunction load?: function load( ) : undefined | { state: any } Returns undefined | { state: any } on Error?: function on Error( error: any ) : void save?: function Awaiter Awaiter< T > : { $$type: "awaiter" ; promise: Promise < T > }
Type Parameters Type declaration $$type: "awaiter" promise: Promise < T > Compare Fn Compare Fn< T > : ( ( a: T , b: T ) => boolean )
Type Parameters Type declaration Parameters Returns boolean Computed Atom Type Parameters Context Context: { aborted: boolean ; signal: AbortController [ "signal" ] | undefined ; abort: any }
Type declaration Readonly aborted: boolean Readonly signal: AbortController [ "signal" ] | undefined abort: function Create Atom Create
Atom
: { ( ) : UpdatableAtom < void > ; < T > ( computeFn
: ( ( context
: Context ) => T | Awaiter < T > ) , options
?: AtomOptions ) : ComputedAtom < T > ; < T , H > ( computeFn
: ( ( context
: Context ) => T | Awaiter < T > ) , options
: AtomOptions & { helpers
: H } ) : GetFn < T > & Omit < Atom < T > , "state" > & { set
: SetFn < T > ; state
: T ; cancel
: any ; defer
: any ; mutate
: any } & AtomExtraProps < H > ; < T > ( initialState
: T | Promise < T > , options
?: AtomOptions ) : UpdatableAtom < T > ; < T , H > ( initialState
: T | Promise < T > , options
: AtomOptions & { helpers
: H } ) : GetFn < T > & Omit < Atom < T > , "state" > & { set
: SetFn < T > ; state
: T ; cancel
: any ; defer
: any ; mutate
: any } & AtomExtraProps < H > ; < T , A > ( initialState
: T , reducer
: ( ( state
: NoInfer < T > , action
: A , context
: Context ) => T | Awaiter < T > ) , options
?: EmittableOptions < A > ) : EmittableAtom < T , A > ; < T , H , A > ( initialState
: T , reducer
: ( ( state
: NoInfer < T > , action
: A , context
: Context ) => T | Awaiter < T > ) , options
: AtomOptions & { initAction
?: A ; onEmit
?: any } & { helpers
: H } ) : GetFn < T > & { error
: any ; get
: GetFn < T > ; key
: string | undefined ; loading
: boolean ; state
: T ; task
: Promise < T > | undefined ; abort
: any ; on
: any ; reset
: any ; snapshot
: any } & { emit
: EmitFn < T , A > ; cancel
: any ; on
: any } & AtomExtraProps < H > } Type declaration ( ) : UpdatableAtom < void > < T > ( computeFn: ( ( context: Context ) => T | Awaiter < T > ) , options?: AtomOptions ) : ComputedAtom < T > < T , H > ( computeFn: ( ( context: Context ) => T | Awaiter < T > ) , options: AtomOptions & { helpers: H } ) : GetFn < T > & Omit < Atom < T > , "state" > & { set: SetFn < T > ; state: T ; cancel: any ; defer: any ; mutate: any } & AtomExtraProps < H > < T > ( initialState: T | Promise < T > , options?: AtomOptions ) : UpdatableAtom < T > < T , H > ( initialState: T | Promise < T > , options: AtomOptions & { helpers: H } ) : GetFn < T > & Omit < Atom < T > , "state" > & { set: SetFn < T > ; state: T ; cancel: any ; defer: any ; mutate: any } & AtomExtraProps < H > < T , A > ( initialState: T , reducer: ( ( state: NoInfer < T > , action: A , context: Context ) => T | Awaiter < T > ) , options?: EmittableOptions < A > ) : EmittableAtom < T , A > < T , H , A > ( initialState: T , reducer: ( ( state: NoInfer < T > , action: A , context: Context ) => T | Awaiter < T > ) , options: AtomOptions & { initAction?: A ; onEmit?: any } & { helpers: H } ) : GetFn < T > & { error: any ; get: GetFn < T > ; key: string | undefined ; loading: boolean ; state: T ; task: Promise < T > | undefined ; abort: any ; on: any ; reset: any ; snapshot: any } & { emit: EmitFn < T , A > ; cancel: any ; on: any } & AtomExtraProps < H > Type Parameters Parameters Type Parameters Parameters Returns GetFn < T > & Omit < Atom < T > , "state" > & { set: SetFn < T > ; state: T ; cancel: any ; defer: any ; mutate: any } & AtomExtraProps < H > Type Parameters Parameters initialState: T | Promise < T > Type Parameters Parameters initialState: T | Promise < T > options: AtomOptions & { helpers: H } Returns GetFn < T > & Omit < Atom < T > , "state" > & { set: SetFn < T > ; state: T ; cancel: any ; defer: any ; mutate: any } & AtomExtraProps < H > Type Parameters Parameters Type Parameters Parameters initialState: T reducer: ( ( state: NoInfer < T > , action: A , context: Context ) => T | Awaiter < T > ) options: AtomOptions & { initAction?: A ; onEmit?: any } & { helpers: H } Returns GetFn < T > & { error: any ; get: GetFn < T > ; key: string | undefined ; loading: boolean ; state: T ; task: Promise < T > | undefined ; abort: any ; on: any ; reset: any ; snapshot: any } & { emit: EmitFn < T , A > ; cancel: any ; on: any } & AtomExtraProps < H > Create Snapshot Create
Snapshot
: { ( atoms
: Atom < any > [] , reset
?: boolean ) : VoidFunction ; < T > ( atoms
: Atom < any > [] , callback
: ( ( ) => T ) ) : T ; < T > ( atoms
: Atom < any > [] , reset
: boolean , callback
: ( ( ) => T ) ) : T } Type declaration ( atoms: Atom < any > [] , reset?: boolean ) : VoidFunction < T > ( atoms: Atom < any > [] , callback: ( ( ) => T ) ) : T < T > ( atoms: Atom < any > [] , reset: boolean , callback: ( ( ) => T ) ) : T Parameters atoms: Atom < any > [] Optional reset: boolean Returns VoidFunction Type Parameters Parameters atoms: Atom < any > [] callback: ( ( ) => T ) Returns T Type Parameters Parameters atoms: Atom < any > [] reset: boolean callback: ( ( ) => T ) Returns T Emittable Atom Emittable
Atom
< T , A > : Atom < T > & { emit
: EmitFn < T , A > ; cancel
: any ; on
: any } Type Parameters Emittable Options Emittable
Options
< A > : AtomOptions & { initAction
?: A ; onEmit
?: any } Type Parameters Get Fn Get Fn< T > : { ( ) : T ; < R > ( selector: ( ( state: T ) => R ) ) : R ; < K > ( path: K ) : PathValue < T , K > }
Type Parameters Type declaration ( ) : T < R > ( selector: ( ( state: T ) => R ) ) : R < K > ( path: K ) : PathValue < T , K > Returns T Type Parameters Parameters selector: ( ( state: T ) => R ) Returns R Type Parameters Parameters Returns PathValue < T , K > Key Of Key Of: { < T , E > ( obj: T , exclude: E [] ) : Exclude < keyof T , E > [] ; < T > ( obj: T ) : ( keyof T ) [] }
Type declaration < T , E > ( obj: T , exclude: E [] ) : Exclude < keyof T , E > [] < T > ( obj: T ) : ( keyof T ) [] Type Parameters T E extends string | number | symbol Parameters Returns Exclude < keyof T , E > [] Type Parameters Parameters Returns ( keyof T ) [] Listener Listener< T , A > : ( ( e: T , a: A ) => void )
Type Parameters Mutation Mutation< T , R > : ( ( prev: T ) => R )
Type Parameters No Infer No Infer< T > : [ T ] [ T extends any ? 0 : never ]
Type Parameters Nullable Nullable< T > : T | undefined | null
Type Parameters Rearg Rearg: { ( func: Function , indexes: number [] ) : ( ( ... args: any [] ) => any ) ; ( func: Function , skip: number ) : ( ( ... args: any [] ) => any ) }
Type declaration ( func: Function , indexes: number [] ) : ( ( ... args: any [] ) => any ) ( func: Function , skip: number ) : ( ( ... args: any [] ) => any ) Parameters func: Function indexes: number [] Returns ( ( ... args: any [] ) => any ) Parameters func: Function skip: number Returns ( ( ... args: any [] ) => any ) Set Fn Set
Fn
< T > : { ( mutation
: Mutation < T , T > ,
... mutations
: Mutation < T , T > [] ) : VoidFunction ; ( state
: T | ( ( prev
: T , context
: Context ) => T | Promise < T > | Awaiter < T > ) | Promise < T > | Awaiter < T > ) : VoidFunction } Type Parameters Type declaration ( mutation: Mutation < T , T > , ... mutations: Mutation < T , T > [] ) : VoidFunction ( state: T | ( ( prev: T , context: Context ) => T | Promise < T > | Awaiter < T > ) | Promise < T > | Awaiter < T > ) : VoidFunction Parameters Returns VoidFunction Parameters Returns VoidFunction Task Task< T , A > : { aborted: boolean ; abort: any ; runner: any }
Type Parameters Type declaration Readonly aborted: boolean abort: function runner: function runner( ... args: A ) : ( ( ) => T ) Parameters Returns ( ( ) => T ) Updatable Atom Updatable
Atom
< T > : GetFn < T > & Omit < Atom < T > , "state" > & { set
: SetFn < T > ; state
: T ; cancel
: any ; defer
: any ; mutate
: any } Type Parameters Wait Wait
: { < A > ( awaitable
: Atom < A > | Awaitable < A > | Promise < A > ) : Awaiter < A > ; < A , T , P > ( awaitable
: Atom < A > | Awaitable < A > | Promise < A > , fn
: ( ( value
: A ,
... args
: P ) => T | Awaiter < T > ) ,
... args
: P ) : T extends Promise < any > ? never : Awaiter < T > ; < A , T , P > ( awaitables
: A , fn
: ( ( values
: { [ key in string | number | symbol ] : A [ key ] extends Atom < V > ? V : A [ key ] extends Promise < V > ? V : never } ,
... args
: P ) => T | Awaiter < T > ) ,
... args
: P ) : T extends Promise < any > ? never : Awaiter < T > } Type declaration < A > ( awaitable: Atom < A > | Awaitable < A > | Promise < A > ) : Awaiter < A > < A , T , P > ( awaitable: Atom < A > | Awaitable < A > | Promise < A > , fn: ( ( value: A , ... args: P ) => T | Awaiter < T > ) , ... args: P ) : T extends Promise < any > ? never : Awaiter < T > < A , T , P > ( awaitables: A , fn: ( ( values: { [ key in string | number | symbol ] : A [ key ] extends Atom < V > ? V : A [ key ] extends Promise < V > ? V : never } , ... args: P ) => T | Awaiter < T > ) , ... args: P ) : T extends Promise < any > ? never : Awaiter < T > Type Parameters Parameters Type Parameters Parameters awaitable: Atom < A > | Awaitable < A > | Promise < A > fn: ( ( value: A , ... args: P ) => T | Awaiter < T > ) ( value: A , ... args: P ) : T | Awaiter < T > Rest ... args: P Returns T extends Promise < any > ? never : Awaiter < T > Type Parameters A extends {} T P extends any [] Parameters awaitables: A fn: ( ( values: { [ key in string | number | symbol ] : A [ key ] extends Atom < V > ? V : A [ key ] extends Promise < V > ? V : never } , ... args: P ) => T | Awaiter < T > ) ( values: { [ key in string | number | symbol ] : A [ key ] extends Atom < V > ? V : A [ key ] extends Promise < V > ? V : never } , ... args: P ) : T | Awaiter < T > Parameters values: { [ key in string | number | symbol ] : A [ key ] extends Atom < V > ? V : A [ key ] extends Promise < V > ? V : never } Rest ... args: P Returns T | Awaiter < T > Rest ... args: P Returns T extends Promise < any > ? never : Awaiter < T > Watch Watch
: { < T > ( changeSelector
: ( ( ) => T ) , callback
: ( ( value
: T ) => void ) ) : VoidFunction ; < T > ( changeSelector
: ( ( ) => T ) , options
: WatchOptions < T > ) : VoidFunction } Type declaration < T > ( changeSelector: ( ( ) => T ) , callback: ( ( value: T ) => void ) ) : VoidFunction < T > ( changeSelector: ( ( ) => T ) , options: WatchOptions < T > ) : VoidFunction Type Parameters Parameters changeSelector: ( ( ) => T ) callback: ( ( value: T ) => void ) Returns VoidFunction Type Parameters Parameters changeSelector: ( ( ) => T ) Returns VoidFunction Watch Options Watch Options< T > : { defer?: boolean ; callback?: any ; compare?: any }
Type Parameters Type declaration Optional defer?: boolean callback?: function compare?: function compare( a: T , b: T ) : boolean Parameters Returns boolean
name of atom, for debugging purpose