import { Try } from '../Any/Try'; import { Narrowable } from './_Internal'; /** * @hidden */ declare type NarrowRaw = (A extends [] ? [] : never) | (A extends Narrowable ? A : never) | ({ [K in keyof A]: A[K] extends Function ? A[K] : NarrowRaw; }); /** * Prevent type widening on generic function parameters * @param A to narrow * @returns `A` * @example * ```ts * import {F} from 'ts-toolbelt' * * declare function foo(x: F.Narrow): A; * declare function bar(x: F.Narrow): A; * * const test0 = foo(['e', 2, true, {f: ['g', ['h']]}]) * // `A` inferred : ['e', 2, true, {f: ['g']}] * * const test1 = bar({a: 1, b: 'c', d: ['e', 2, true, {f: ['g']}]}) * // `A` inferred : {a: 1, b: 'c', d: ['e', 2, true, {f: ['g']}]} * ``` */ declare type Narrow = Try>; export { Narrow };