type-plus 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -10
- package/cjs/any_plus/any.d.ts +29 -0
- package/cjs/any_plus/any.d.ts.map +1 -0
- package/cjs/{number_plus/_plus.js → any_plus/any.js} +1 -1
- package/cjs/any_plus/any.js.map +1 -0
- package/cjs/any_plus/index.d.ts +2 -0
- package/cjs/any_plus/index.d.ts.map +1 -0
- package/cjs/{predicates/IsAny.js → any_plus/index.js} +1 -1
- package/cjs/any_plus/index.js.map +1 -0
- package/cjs/array_plus/array.d.ts +16 -5
- package/cjs/array_plus/array.d.ts.map +1 -1
- package/cjs/array_plus/array_plus.d.ts +35 -0
- package/cjs/array_plus/array_plus.d.ts.map +1 -0
- package/cjs/array_plus/{_plus.js → array_plus.js} +1 -1
- package/cjs/array_plus/array_plus.js.map +1 -0
- package/cjs/array_plus/create_tuple.d.ts +1 -1
- package/cjs/array_plus/create_tuple.d.ts.map +1 -1
- package/cjs/array_plus/index.d.ts +15 -15
- package/cjs/array_plus/index.d.ts.map +1 -1
- package/cjs/array_plus/pad_left.d.ts +4 -3
- package/cjs/array_plus/pad_left.d.ts.map +1 -1
- package/cjs/array_plus/tail.d.ts +1 -1
- package/cjs/array_plus/tail.d.ts.map +1 -1
- package/cjs/assertion/assertType.d.ts +1 -1
- package/cjs/assertion/assertType.d.ts.map +1 -1
- package/cjs/assertion/assertType.js.map +1 -1
- package/cjs/index.d.ts +3 -2
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +6 -5
- package/cjs/index.js.map +1 -1
- package/cjs/math/Max.d.ts +1 -1
- package/cjs/math/Max.d.ts.map +1 -1
- package/cjs/number_plus/number.d.ts +13 -0
- package/cjs/number_plus/number.d.ts.map +1 -1
- package/cjs/number_plus/number_plus.d.ts +2 -0
- package/cjs/number_plus/number_plus.d.ts.map +1 -0
- package/cjs/number_plus/number_plus.js +3 -0
- package/cjs/number_plus/number_plus.js.map +1 -0
- package/cjs/object/IsDisjoint.d.ts +2 -2
- package/cjs/object/IsDisjoint.d.ts.map +1 -1
- package/cjs/object/KeysWithDiffType.d.ts +1 -1
- package/cjs/object/KeysWithDiffType.d.ts.map +1 -1
- package/cjs/object/KnownKeys.d.ts +1 -1
- package/cjs/object/KnownKeys.d.ts.map +1 -1
- package/cjs/object/OptionalKeys.d.ts +1 -1
- package/cjs/object/OptionalKeys.d.ts.map +1 -1
- package/cjs/object/Partial.d.ts +3 -3
- package/cjs/object/Partial.d.ts.map +1 -1
- package/cjs/object/getField.d.ts +1 -1
- package/cjs/object/getField.d.ts.map +1 -1
- package/cjs/object/mapKey.d.ts +1 -1
- package/cjs/object/mapKey.d.ts.map +1 -1
- package/cjs/object/mapProperties.d.ts +1 -1
- package/cjs/object/mapProperties.d.ts.map +1 -1
- package/cjs/object/omit.d.ts +3 -3
- package/cjs/object/omit.d.ts.map +1 -1
- package/cjs/object/omit.js +2 -2
- package/cjs/object/omit.js.map +1 -1
- package/cjs/object/pick.d.ts +1 -1
- package/cjs/object/pick.d.ts.map +1 -1
- package/cjs/predicates/Equal.d.ts +1 -1
- package/cjs/predicates/Equal.d.ts.map +1 -1
- package/cjs/predicates/index.d.ts +0 -1
- package/cjs/predicates/index.d.ts.map +1 -1
- package/cjs/predicates/index.js.map +1 -1
- package/cjs/promise/PromiseValueMerge.d.ts +1 -2
- package/cjs/promise/PromiseValueMerge.d.ts.map +1 -1
- package/esm/any_plus/any.d.ts +29 -0
- package/esm/any_plus/any.d.ts.map +1 -0
- package/esm/any_plus/any.js +2 -0
- package/esm/any_plus/any.js.map +1 -0
- package/esm/any_plus/index.d.ts +2 -0
- package/esm/any_plus/index.d.ts.map +1 -0
- package/esm/any_plus/index.js +2 -0
- package/esm/any_plus/index.js.map +1 -0
- package/esm/array_plus/array.d.ts +16 -5
- package/esm/array_plus/array.d.ts.map +1 -1
- package/esm/array_plus/array_plus.d.ts +35 -0
- package/esm/array_plus/array_plus.d.ts.map +1 -0
- package/esm/array_plus/array_plus.js +2 -0
- package/esm/array_plus/array_plus.js.map +1 -0
- package/esm/array_plus/create_tuple.d.ts +1 -1
- package/esm/array_plus/create_tuple.d.ts.map +1 -1
- package/esm/array_plus/index.d.ts +15 -15
- package/esm/array_plus/index.d.ts.map +1 -1
- package/esm/array_plus/pad_left.d.ts +4 -3
- package/esm/array_plus/pad_left.d.ts.map +1 -1
- package/esm/array_plus/tail.d.ts +1 -1
- package/esm/array_plus/tail.d.ts.map +1 -1
- package/esm/assertion/assertType.d.ts +1 -1
- package/esm/assertion/assertType.d.ts.map +1 -1
- package/esm/assertion/assertType.js.map +1 -1
- package/esm/index.d.ts +3 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/math/Max.d.ts +1 -1
- package/esm/math/Max.d.ts.map +1 -1
- package/esm/number_plus/number.d.ts +13 -0
- package/esm/number_plus/number.d.ts.map +1 -1
- package/esm/number_plus/number_plus.d.ts +2 -0
- package/esm/number_plus/number_plus.d.ts.map +1 -0
- package/esm/number_plus/number_plus.js +2 -0
- package/esm/number_plus/number_plus.js.map +1 -0
- package/esm/object/IsDisjoint.d.ts +2 -2
- package/esm/object/IsDisjoint.d.ts.map +1 -1
- package/esm/object/KeysWithDiffType.d.ts +1 -1
- package/esm/object/KeysWithDiffType.d.ts.map +1 -1
- package/esm/object/KnownKeys.d.ts +1 -1
- package/esm/object/KnownKeys.d.ts.map +1 -1
- package/esm/object/OptionalKeys.d.ts +1 -1
- package/esm/object/OptionalKeys.d.ts.map +1 -1
- package/esm/object/Partial.d.ts +3 -3
- package/esm/object/Partial.d.ts.map +1 -1
- package/esm/object/getField.d.ts +1 -1
- package/esm/object/getField.d.ts.map +1 -1
- package/esm/object/mapKey.d.ts +1 -1
- package/esm/object/mapKey.d.ts.map +1 -1
- package/esm/object/mapProperties.d.ts +1 -1
- package/esm/object/mapProperties.d.ts.map +1 -1
- package/esm/object/omit.d.ts +3 -3
- package/esm/object/omit.d.ts.map +1 -1
- package/esm/object/omit.js +1 -1
- package/esm/object/omit.js.map +1 -1
- package/esm/object/pick.d.ts +1 -1
- package/esm/object/pick.d.ts.map +1 -1
- package/esm/predicates/Equal.d.ts +1 -1
- package/esm/predicates/Equal.d.ts.map +1 -1
- package/esm/predicates/index.d.ts +0 -1
- package/esm/predicates/index.d.ts.map +1 -1
- package/esm/predicates/index.js.map +1 -1
- package/esm/promise/PromiseValueMerge.d.ts +1 -2
- package/esm/promise/PromiseValueMerge.d.ts.map +1 -1
- package/package.json +3 -3
- package/ts/any_plus/any.ts +29 -0
- package/ts/any_plus/index.ts +1 -0
- package/ts/array_plus/array.ts +21 -11
- package/ts/array_plus/array_plus.ts +66 -0
- package/ts/array_plus/create_tuple.ts +1 -1
- package/ts/array_plus/index.ts +15 -15
- package/ts/array_plus/pad_left.ts +4 -3
- package/ts/array_plus/tail.ts +1 -1
- package/ts/assertion/assertType.ts +1 -1
- package/ts/index.ts +3 -2
- package/ts/math/Max.ts +1 -1
- package/ts/number_plus/number.ts +14 -0
- package/ts/object/IsDisjoint.ts +2 -2
- package/ts/object/KeysWithDiffType.ts +1 -1
- package/ts/object/KnownKeys.ts +1 -1
- package/ts/object/OptionalKeys.ts +1 -1
- package/ts/object/Partial.ts +3 -3
- package/ts/object/getField.ts +1 -1
- package/ts/object/mapKey.ts +1 -1
- package/ts/object/mapProperties.ts +1 -1
- package/ts/object/omit.ts +4 -3
- package/ts/object/pick.ts +1 -1
- package/ts/predicates/Equal.ts +1 -1
- package/ts/predicates/index.ts +0 -1
- package/ts/promise/PromiseValueMerge.ts +9 -11
- package/cjs/array_plus/_plus.d.ts +0 -2
- package/cjs/array_plus/_plus.d.ts.map +0 -1
- package/cjs/array_plus/_plus.js.map +0 -1
- package/cjs/number_plus/_plus.d.ts +0 -2
- package/cjs/number_plus/_plus.d.ts.map +0 -1
- package/cjs/number_plus/_plus.js.map +0 -1
- package/cjs/predicates/IsAny.d.ts +0 -3
- package/cjs/predicates/IsAny.d.ts.map +0 -1
- package/cjs/predicates/IsAny.js.map +0 -1
- package/esm/array_plus/_plus.d.ts +0 -2
- package/esm/array_plus/_plus.d.ts.map +0 -1
- package/esm/array_plus/_plus.js +0 -2
- package/esm/array_plus/_plus.js.map +0 -1
- package/esm/number_plus/_plus.d.ts +0 -2
- package/esm/number_plus/_plus.d.ts.map +0 -1
- package/esm/number_plus/_plus.js +0 -2
- package/esm/number_plus/_plus.js.map +0 -1
- package/esm/predicates/IsAny.d.ts +0 -3
- package/esm/predicates/IsAny.d.ts.map +0 -1
- package/esm/predicates/IsAny.js +0 -2
- package/esm/predicates/IsAny.js.map +0 -1
- package/ts/array_plus/_plus.ts +0 -1
- package/ts/predicates/IsAny.ts +0 -3
- /package/ts/number_plus/{_plus.ts → number_plus.ts} +0 -0
package/ts/number_plus/number.ts
CHANGED
|
@@ -16,9 +16,11 @@ export type Zero = 0 | 0n
|
|
|
16
16
|
*
|
|
17
17
|
* type R = Integer<0> // 0
|
|
18
18
|
* type R = Integer<1.1> // never
|
|
19
|
+
* type R = Integer<number> // never as it contains non-integer
|
|
19
20
|
*
|
|
20
21
|
* type R = Integer<0, true, false> // true
|
|
21
22
|
* type R = Integer<1.1, true, false> // false
|
|
23
|
+
*
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
26
|
export type Integer<N extends Numeric, Then = N, Else = never> = `${N}` extends `${bigint}` ? Then : Else
|
|
@@ -56,3 +58,15 @@ export type Negative<N extends Numeric, Then = N, Else = never> = N extends Zero
|
|
|
56
58
|
* ```
|
|
57
59
|
*/
|
|
58
60
|
export type NonNegative<N extends Numeric, Then = N, Else = never> = Negative<N, Else, Then>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Check if the type `T` is exactly the type `number` and not numeric literals.
|
|
64
|
+
*
|
|
65
|
+
* ```
|
|
66
|
+
* import type { NumberType } from 'type-plus'
|
|
67
|
+
*
|
|
68
|
+
* type R = NumberType<number> // true
|
|
69
|
+
* type R = NumberType<1> // false
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export type NumberType<T extends number, Then = T, Else = never> = number extends T ? Then : Else
|
package/ts/object/IsDisjoint.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { And, Not } from '../predicates/index.js'
|
|
1
|
+
import type { And, Not } from '../predicates/index.js'
|
|
2
2
|
import type { AnyRecord } from './AnyRecord.js'
|
|
3
|
-
import { HasKey } from './hasKey.js'
|
|
3
|
+
import type { HasKey } from './hasKey.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Are the two records disjoint from each other.
|
package/ts/object/KnownKeys.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// known from Gerrit Birkeland @Gerrit0
|
|
3
3
|
// https://github.com/Microsoft/TypeScript/issues/25987#issuecomment-408339599
|
|
4
4
|
|
|
5
|
-
import { PrimitiveTypes } from '../PrimitiveTypes.js'
|
|
5
|
+
import type { PrimitiveTypes } from '../PrimitiveTypes.js'
|
|
6
6
|
|
|
7
7
|
// https://github.com/microsoft/TypeScript/issues/25987#issuecomment-441224690
|
|
8
8
|
export type KnownKeys<T> = T extends PrimitiveTypes
|
package/ts/object/Partial.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UnionKeys } from '../UnionKeys.js'
|
|
2
|
-
import { Omit } from './omit.js'
|
|
3
|
-
import { Pick } from './pick.js'
|
|
1
|
+
import type { UnionKeys } from '../UnionKeys.js'
|
|
2
|
+
import type { Omit } from './omit.js'
|
|
3
|
+
import type { Pick } from './pick.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Apply `Partial<>` on the selected properties.
|
package/ts/object/getField.ts
CHANGED
package/ts/object/mapKey.ts
CHANGED
package/ts/object/omit.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Pick } from './pick.js'
|
|
1
|
+
import type { UnionKeys } from '../UnionKeys.js'
|
|
2
|
+
import type { AnyRecord } from './AnyRecord.js'
|
|
3
|
+
import type { Pick } from './pick.js'
|
|
4
4
|
import { record } from './record.js'
|
|
5
|
+
import { reduceByKey } from './reduceKey.js'
|
|
5
6
|
|
|
6
7
|
// by Titian Cernicova-Dragomir
|
|
7
8
|
// https://github.com/microsoft/TypeScript/issues/28339#issuecomment-463577347
|
package/ts/object/pick.ts
CHANGED
package/ts/predicates/Equal.ts
CHANGED
package/ts/predicates/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './CanAssign.js'
|
|
|
2
2
|
export type { Equal, IsEqual, IsNotEqual, NotEqual } from './Equal.js'
|
|
3
3
|
export type { Extendable, IsExtend, IsNotExtend, NotExtendable } from './Extends.js'
|
|
4
4
|
export type { If } from './If.js'
|
|
5
|
-
export type { IsAny } from './IsAny.js'
|
|
6
5
|
export type { IsEmptyObject } from './IsEmptyObject.js'
|
|
7
6
|
export * from './isType.js'
|
|
8
7
|
export type { And, Not, Or, Xor } from './logical.js'
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { PromiseValue } from './PromiseValue.js'
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Merging value types from multiple promises.
|
|
5
3
|
*/
|
|
@@ -14,13 +12,13 @@ export type PromiseValueMerge<
|
|
|
14
12
|
P8 extends Promise<any> = any,
|
|
15
13
|
P9 extends Promise<any> = any
|
|
16
14
|
> = Promise<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
Awaited<P1> &
|
|
16
|
+
Awaited<P2> &
|
|
17
|
+
Awaited<P3> &
|
|
18
|
+
Awaited<P4> &
|
|
19
|
+
Awaited<P5> &
|
|
20
|
+
Awaited<P6> &
|
|
21
|
+
Awaited<P7> &
|
|
22
|
+
Awaited<P8> &
|
|
23
|
+
Awaited<P9>
|
|
26
24
|
>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.d.ts","sourceRoot":"","sources":["../../ts/array_plus/_plus.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.js","sourceRoot":"","sources":["../../ts/array_plus/_plus.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.d.ts","sourceRoot":"","sources":["../../ts/number_plus/_plus.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.js","sourceRoot":"","sources":["../../ts/number_plus/_plus.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsAny.d.ts","sourceRoot":"","sources":["../../ts/predicates/IsAny.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,SAAS,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsAny.js","sourceRoot":"","sources":["../../ts/predicates/IsAny.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.d.ts","sourceRoot":"","sources":["../../ts/array_plus/_plus.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA"}
|
package/esm/array_plus/_plus.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.js","sourceRoot":"","sources":["../../ts/array_plus/_plus.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.d.ts","sourceRoot":"","sources":["../../ts/number_plus/_plus.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAA"}
|
package/esm/number_plus/_plus.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_plus.js","sourceRoot":"","sources":["../../ts/number_plus/_plus.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsAny.d.ts","sourceRoot":"","sources":["../../ts/predicates/IsAny.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,SAAS,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA"}
|
package/esm/predicates/IsAny.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsAny.js","sourceRoot":"","sources":["../../ts/predicates/IsAny.ts"],"names":[],"mappings":""}
|
package/ts/array_plus/_plus.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from './array.js'
|
package/ts/predicates/IsAny.ts
DELETED
|
File without changes
|