mini-rx-store
Version:
MiniRx: The Lightweight RxJS Redux Store
17 lines (16 loc) • 684 B
TypeScript
import { Observable } from 'rxjs';
export type CreateSelectFnReturn<StateType extends object> = {
(): Observable<StateType>;
<R>(mapFn: (state: StateType) => R): Observable<R>;
<KeyType extends keyof StateType>(key: KeyType): Observable<StateType[KeyType]>;
};
export declare function createState<StateType extends object>(initialState: StateType): {
select: CreateSelectFnReturn<StateType>;
get: () => StateType;
set: (v: StateType) => void;
};
export declare function createLazyState<StateType extends object>(initialState?: StateType): {
select: CreateSelectFnReturn<StateType>;
get: () => StateType | undefined;
set: (v: StateType) => void;
};