Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

Extends

Extends<A1, A2>: [A1] extends [never] ? 0 : A1 extends A2 ? 1 : 0

Check whether A1 is part of A2 or not. The difference with extends is that it forces a Boolean return.

Type parameters

  • A1: any
  • A2: any

returns

Boolean

example

import {A} from 'ts-toolbelt'

type test0 = A.Extends<'a' | 'b', 'b'> // Boolean
type test1 = A.Extends<'a', 'a' | 'b'> // True

type test2 = A.Extends<{a: string}, {a: any}>      // True
type test3 = A.Extends<{a: any}, {a: any, b: any}> // False

type test4 = A.Extends<never, never> // False
/// Nothing cannot extend nothing, use `A.Equals`

  • 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.