@codeparticle/rdx
Version:
RDX is a module based redux framework that generates boilerplate for you.
12 lines (9 loc) • 1.22 kB
TypeScript
import { O as Object$1, S as Split } from '../_Internal.d-b77d7bab';
import { P as Path } from '../Path.d-b1ed7658';
import { A as AutoPath } from '../AutoPath.d-5ff8a441';
declare type PathOrBackup<State extends Object$1, Path extends string, BackupValue = null> = [Path] extends [''] ? BackupValue : Path<State, Split<Path, '.'>> extends never ? BackupValue : Path<State, Split<Path, '.'>>;
declare function get<State extends Object$1, Path extends string = string, BackupValue = null>(state: State, path: AutoPath<State, Path>, backupValue?: BackupValue): PathOrBackup<State, Path, BackupValue>;
declare function get<State extends Object$1>(s: State): <Path extends string, BackupValue = null>(path: AutoPath<State, Path>, backupValue?: BackupValue) => PathOrBackup<State, Path, BackupValue>;
declare function get<State extends any[], Path extends string, BackupValue = null>(state: State, path: AutoPath<State, Path>, backupValue?: BackupValue): PathOrBackup<State, Path, BackupValue>;
declare function get<State extends any[]>(s: State): <Path extends string, BackupValue = null>(path: AutoPath<State, Path>, backupValue?: BackupValue) => PathOrBackup<State, Path, BackupValue>;
export { PathOrBackup, get };