Skip to main content
Module

x/ts_toolbelt_unofficial/mod.ts>N.Negate

👷 TypeScript's largest type utility library, now on Deno
Latest
type alias N.Negate
import { type N } from "https://deno.land/x/ts_toolbelt_unofficial@1.1.0/mod.ts";
const { Negate } = N;

Negate a [[Number]]

Examples

Example 1

import {N} from 'ts-toolbelt.ts'

type test0 = N.Negate<'-10'>     //  '10'
type test1 = N.Negate<'10'>      // '-10'
type test2 = N.Negate<'10', 's'> // '-10'
type test3 = N.Negate<'10', 'n'> //  -10
type test4 = N.Negate<'-100'>    // string

Type Parameters

N extends number
definition: N extends unknown ? _Negate<IterationOf<N>>[0] : never