Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

IsLiteral

IsLiteral<A, kind>: And<Or<IsStringLiteral<A>, IsNumberLiteral<A>>, Extends<A, kind>>

Determine whether A is literal or not

Type parameters

  • A: any

    to be checked

  • kind: Kind

    (?='string' | 'number') to restrict

example

import {A} from 'ts-toolbelt'

type test0 = A.IsLiteral<1 | 2> // 1
type test1 = A.IsLiteral<1 | 2, string> // 0
type test2 = A.IsLiteral<1 | '2', string> // 0 | 1
type test3 = A.IsLiteral<number> // 0

Kind

Kind: string | number

Literal to restrict against

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