From b8a5dd4c90dbd072f2d8e7ee511a190a7da5ed0b Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 8 Apr 2024 12:17:18 +0900 Subject: [PATCH] Update numeric.d.ts --- source/numeric.d.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/numeric.d.ts b/source/numeric.d.ts index 29315d25c..25b504740 100644 --- a/source/numeric.d.ts +++ b/source/numeric.d.ts @@ -23,18 +23,24 @@ Like [`Number#IsInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScr ``` type Integer = IsInteger<1>; //=> true + type IntegerWithDecimal = IsInteger<1.0>; //=> true + type NegativeInteger = IsInteger<-1>; //=> true + type Float = IsInteger<1.5>; //=> false -//=> supported non-decimal numbers +// Supports non-decimal numbers + type OctalInteger: IsInteger<0o10>; //=> true + type BinaryInteger: IsInteger<0b10>; //=> true + type HexadecimalInteger: IsInteger<0x10>; //=> true ``` @@ -101,18 +107,24 @@ Use-case: Validating and documenting parameters. ``` type Integer = Integer<1>; //=> 1 + type IntegerWithDecimal = Integer<1.0>; //=> 1 + type NegativeInteger = Integer<-1>; //=> -1 + type Float = Integer<1.5>; //=> never -//=> supported non-decimal numbers +// Supports non-decimal numbers + type OctalInteger: Integer<0o10>; //=> 0o10 + type BinaryInteger: Integer<0b10>; //=> 0b10 + type HexadecimalInteger: Integer<0x10>; //=> 0x10 ```