Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

Narrow

Narrow<A>: Try<A, [], NarrowRaw<A>>

Prevent type widening on generic function parameters

Type parameters

  • A: any

    to narrow

returns

A

example

import {F} from 'ts-toolbelt'

declare function foo<A extends any[]>(x: F.Narrow<A>): A;
declare function bar<A extends object>(x: F.Narrow<A>): 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']}]}

  • Inherited
  • Protected
  • Private
  • Static
  • Module
  • Object
  • Property
  • Function
  • Variable
  • Index
  • Type
  • Class
  • Interface
  • Enum
  • Constructor
  • Getter/Setter
Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.