source: node_modules/ts-toolbelt/out/Number/Absolute.d.ts

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 738 bytes
Line 
1import { _Negate } from './Negate';
2import { _IsNegative } from './IsNegative';
3import { IterationOf } from '../Iteration/IterationOf';
4import { Iteration } from '../Iteration/Iteration';
5/**
6 * @hidden
7 */
8export declare type _Absolute<N extends Iteration> = {
9 0: N;
10 1: _Negate<N>;
11}[_IsNegative<N>];
12/**
13 * Get the absolute value of a [[Number]]
14 * @param N to absolute
15 * @returns `string | number | boolean`
16 * @example
17 * ```ts
18 * import {N} from 'ts-toolbelt'
19 *
20 * type test0 = N.Absolute<'-20'> // '20'
21 *
22 * type test1 = N.Absolute<'-20', 's'> // '20'
23 * type test2 = N.Absolute<'-20', 'n'> // 20
24 * ```
25 */
26export declare type Absolute<N extends number> = N extends unknown ? _Absolute<IterationOf<N>>[0] : never;
Note: See TracBrowser for help on using the repository browser.