Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

Sub

Sub<N1, N2>: N1 extends unknown ? N2 extends unknown ? _Sub<IterationOf<N1>, IterationOf<N2>>[0] : never : never

Subtract a [[Number]] from another one

Type parameters

  • N1: number

    Left-hand side

  • N2: number

    Right-hand side

returns

string | number | boolean

example

import {N} from 'ts-toolbelt'

type test0 = N.Sub<'2', '10'>        // '-8'
type test1 = N.Sub<'0', '40'>        // '-40'
type test2 = N.Sub<'0', '40', 's'>   // '-40'
type test3 = N.Sub<'0', '40', 'n'>   //  -40
type test4 = N.Sub<'-20', '40', 's'> // string
type test5 = N.Sub<'-20', '40', 'n'> // number

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