import type { DeepPath, Fn, Maybe, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8 } from "@thi.ng/api"; /** * Non-typechecked version of {@link defGetter}. * * @remarks * The type parameter `T` can be used to indicate the type of the nested value * to be retrieved (default: `any`). * * Also see: {@link getIn}, {@link getInUnsafe} * * @example * ```ts tangle:../export/def-getter-unsafe.ts * import { defGetterUnsafe } from "@thi.ng/paths"; * * const g = defGetterUnsafe("a.b.c"); * * console.log(g({ a: { b: { c: 23} } })); * // 23 * * console.log(g({ x: 23 })); * // undefined * ``` * * @param path - */ export declare const defGetterUnsafe: (path: Path) => Fn>; /** * Creates getter function for given nested lookup path. Returns * function which accepts single object and returns value at given path. * * @remarks * Optimized fast execution paths are provided for path lengths <= 4. * Only the first 8 path levels are type checked. * * Supports any `[]`-indexable data structure (arrays, objects, * strings). * * If any intermediate key is not present in the given obj, further * descent stops and the function returns `undefined`. * * If `path` is an empty array, the returned getter will simply return * the given state arg (aka identity function). * * Also see: {@link defGetterUnsafe}, {@link getIn}, {@link getInUnsafe} * * @example * ```ts tangle:../export/def-getter.ts * import { defGetter } from "@thi.ng/paths"; * * interface Foo { * a: { b: { c: number; } } * } * * // fully type checked getter * const g = defGetter(["a","b","c"]); * * // error (wrong `d` key) * // g = defGetter(["a","b","d"]); * * console.log(g({ a: { b: { c: 23} } })); * // 23 * * // error * console.log(g({ x: 23 })); * * // error * console.log(g()); * ``` * * @param path - */ export declare function defGetter(path: Path0): Fn; export declare function defGetter(path: Path1): Fn>; export declare function defGetter(path: Path2): Fn>; export declare function defGetter(path: Path3): Fn>; export declare function defGetter(path: Path4): Fn>; export declare function defGetter(path: Path5): Fn>; export declare function defGetter(path: Path6): Fn>; export declare function defGetter(path: Path7): Fn>; export declare function defGetter(path: Path8): Fn>; export declare function defGetter(path: DeepPath): Fn; //# sourceMappingURL=getter.d.ts.map