@zedux/atoms
Version:
A Molecular State Engine for React
44 lines (43 loc) • 1.94 kB
TypeScript
import { Store, StoreStateType } from '@zedux/core';
import { AtomConfig, AtomApiPromise, AtomValueOrFactory, PromiseState } from '../types/index.js';
import { AtomTemplate } from '../classes/templates/AtomTemplate.js';
import { AtomApi } from '../classes/AtomApi.js';
export declare const atom: {
<State = any, Params extends any[] = [], Exports extends Record<string, any> = Record<string, never>>(key: string, value: (...params: Params) => AtomApi<{
Exports: Exports;
Promise: any;
State: Promise<State>;
Store: undefined;
}>, config?: AtomConfig<State>): AtomTemplate<{
State: PromiseState<State>;
Params: Params;
Exports: Exports;
Store: Store<PromiseState<State>>;
Promise: Promise<State>;
}>;
<StoreType extends Store<any> = Store<any>, Params extends any[] = [], Exports extends Record<string, any> = Record<string, never>, PromiseType extends AtomApiPromise = undefined>(key: string, value: (...params: Params) => StoreType | AtomApi<{
Exports: Exports;
Promise: PromiseType;
State: StoreStateType<Store>;
Store: StoreType;
}>, config?: AtomConfig<StoreStateType<StoreType>>): AtomTemplate<{
State: StoreStateType<StoreType>;
Params: Params;
Exports: Exports;
Store: StoreType;
Promise: PromiseType;
}>;
<State = any, Params extends any[] = [], Exports extends Record<string, any> = Record<string, never>, StoreType extends Store<State> = Store<State>, PromiseType extends AtomApiPromise = undefined>(key: string, value: AtomValueOrFactory<{
Exports: Exports;
Params: Params;
Promise: PromiseType;
State: State;
Store: StoreType;
}>, config?: AtomConfig<State>): AtomTemplate<{
Exports: Exports;
Params: Params;
Promise: PromiseType;
State: State;
Store: StoreType;
}>;
};