Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "Any/Cast"

Index

Type aliases

Type aliases

Cast

Cast<A1, A2>: Cast<A1, A2>

Ask TS to re-check that A1 extends A2. And if it fails, A2 will be enforced anyway. Can also be used to add constraints on parameters.

Type parameters

  • A1: any

    to check against

  • A2: any

    to cast A1 to

returns

A1 or A2

example

import {A} from 'ts-toolbelt'

type test0 = A.Cast<'42', string> // '42'
type test1 = A.Cast<'42', number> // number

Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.