type-plus 7.0.1 → 7.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 +4 -34
- package/cjs/any/any_type.d.ts +17 -7
- package/cjs/any/any_type.d.ts.map +1 -1
- package/cjs/array/array.some.d.ts +6 -2
- package/cjs/array/array.some.d.ts.map +1 -1
- package/cjs/array/array_plus.split_at.d.ts +1 -1
- package/cjs/array/array_plus.split_at.d.ts.map +1 -1
- package/cjs/array/reduce_while.js.map +1 -1
- package/cjs/assertion/assert_type.d.ts +3 -3
- package/cjs/assertion/assert_type.d.ts.map +1 -1
- package/cjs/assertion/assert_type.js +6 -3
- package/cjs/assertion/assert_type.js.map +1 -1
- package/cjs/bigint/bigint_type.d.ts +1 -1
- package/cjs/bigint/bigint_type.d.ts.map +1 -1
- package/cjs/bigint/strict_bigint_type.d.ts +1 -1
- package/cjs/bigint/strict_bigint_type.d.ts.map +1 -1
- package/cjs/binary/index.js +2 -25
- package/cjs/binary/index.js.map +1 -1
- package/cjs/boolean/boolean_type.d.ts +1 -1
- package/cjs/boolean/boolean_type.d.ts.map +1 -1
- package/cjs/boolean/false_type.d.ts +1 -1
- package/cjs/boolean/false_type.d.ts.map +1 -1
- package/cjs/boolean/strict_boolean_type.d.ts +1 -1
- package/cjs/boolean/strict_boolean_type.d.ts.map +1 -1
- package/cjs/boolean/true_type.d.ts +1 -1
- package/cjs/boolean/true_type.d.ts.map +1 -1
- package/cjs/equal/equal.d.ts +18 -18
- package/cjs/function/function_type.d.ts +1 -1
- package/cjs/function/function_type.d.ts.map +1 -1
- package/cjs/function/strict_function_type.d.ts +1 -1
- package/cjs/function/strict_function_type.d.ts.map +1 -1
- package/cjs/functional/context.js.map +1 -1
- package/cjs/index.d.ts +2 -2
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +7 -22
- package/cjs/index.js.map +1 -1
- package/cjs/mix_types/any_or_never_type.d.ts +29 -0
- package/cjs/mix_types/any_or_never_type.d.ts.map +1 -0
- package/cjs/{any/any_or_never.js → mix_types/any_or_never_type.js} +1 -1
- package/cjs/mix_types/any_or_never_type.js.map +1 -0
- package/cjs/number/number_type.d.ts +1 -1
- package/cjs/number/number_type.d.ts.map +1 -1
- package/cjs/numeric/integer.d.ts +1 -1
- package/cjs/numeric/integer.d.ts.map +1 -1
- package/cjs/numeric/numeric_type.d.ts +1 -1
- package/cjs/numeric/numeric_type.d.ts.map +1 -1
- package/cjs/object/ANotB.d.ts +3 -2
- package/cjs/object/ANotB.d.ts.map +1 -1
- package/cjs/object/Required.d.ts +1 -1
- package/cjs/object/Required.d.ts.map +1 -1
- package/cjs/object/findKey.d.ts +1 -1
- package/cjs/object/findKey.d.ts.map +1 -1
- package/cjs/object/forEachKey.d.ts +1 -1
- package/cjs/object/forEachKey.d.ts.map +1 -1
- package/cjs/object/hasProperty.d.ts +1 -1
- package/cjs/object/hasProperty.d.ts.map +1 -1
- package/cjs/object/object_type.d.ts +1 -1
- package/cjs/object/object_type.d.ts.map +1 -1
- package/cjs/object/split.d.ts +1 -1
- package/cjs/object/split.d.ts.map +1 -1
- package/cjs/package.json +3 -1
- package/cjs/primitive.d.ts +3 -0
- package/cjs/primitive.d.ts.map +1 -1
- package/cjs/string/string_type.d.ts +1 -1
- package/cjs/string/string_type.d.ts.map +1 -1
- package/cjs/symbol/symbol_type.d.ts +1 -1
- package/cjs/symbol/symbol_type.d.ts.map +1 -1
- package/cjs/testing/stub.d.ts +3 -0
- package/cjs/testing/stub.d.ts.map +1 -1
- package/cjs/testing/stub.js.map +1 -1
- package/cjs/type/failed.d.ts +1 -1
- package/cjs/type/failed.d.ts.map +1 -1
- package/cjs/type/no_infer.d.ts +9 -6
- package/cjs/type/no_infer.d.ts.map +1 -1
- package/cjs/type-guard/is_type.d.ts +1 -1
- package/cjs/type-guard/is_type.js +1 -1
- package/cjs/type-guard/is_type.js.map +1 -1
- package/cjs/unpartial.d.ts +2 -0
- package/cjs/unpartial.d.ts.map +1 -0
- package/cjs/unpartial.js +8 -0
- package/cjs/unpartial.js.map +1 -0
- package/cjs/void/void_type.d.ts +1 -1
- package/cjs/void/void_type.d.ts.map +1 -1
- package/esm/any/any_type.d.ts +17 -7
- package/esm/any/any_type.d.ts.map +1 -1
- package/esm/array/array.some.d.ts +6 -2
- package/esm/array/array.some.d.ts.map +1 -1
- package/esm/array/array_plus.split_at.d.ts +1 -1
- package/esm/array/array_plus.split_at.d.ts.map +1 -1
- package/esm/array/reduce_while.js.map +1 -1
- package/esm/assertion/assert_type.d.ts +3 -3
- package/esm/assertion/assert_type.d.ts.map +1 -1
- package/esm/assertion/assert_type.js +7 -3
- package/esm/assertion/assert_type.js.map +1 -1
- package/esm/bigint/bigint_type.d.ts +1 -1
- package/esm/bigint/bigint_type.d.ts.map +1 -1
- package/esm/bigint/strict_bigint_type.d.ts +1 -1
- package/esm/bigint/strict_bigint_type.d.ts.map +1 -1
- package/esm/boolean/boolean_type.d.ts +1 -1
- package/esm/boolean/boolean_type.d.ts.map +1 -1
- package/esm/boolean/false_type.d.ts +1 -1
- package/esm/boolean/false_type.d.ts.map +1 -1
- package/esm/boolean/strict_boolean_type.d.ts +1 -1
- package/esm/boolean/strict_boolean_type.d.ts.map +1 -1
- package/esm/boolean/true_type.d.ts +1 -1
- package/esm/boolean/true_type.d.ts.map +1 -1
- package/esm/equal/equal.d.ts +18 -18
- package/esm/function/function_type.d.ts +1 -1
- package/esm/function/function_type.d.ts.map +1 -1
- package/esm/function/strict_function_type.d.ts +1 -1
- package/esm/function/strict_function_type.d.ts.map +1 -1
- package/esm/functional/context.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/mix_types/any_or_never_type.d.ts +29 -0
- package/esm/mix_types/any_or_never_type.d.ts.map +1 -0
- package/esm/mix_types/any_or_never_type.js +2 -0
- package/esm/mix_types/any_or_never_type.js.map +1 -0
- package/esm/number/number_type.d.ts +1 -1
- package/esm/number/number_type.d.ts.map +1 -1
- package/esm/numeric/integer.d.ts +1 -1
- package/esm/numeric/integer.d.ts.map +1 -1
- package/esm/numeric/numeric_type.d.ts +1 -1
- package/esm/numeric/numeric_type.d.ts.map +1 -1
- package/esm/object/ANotB.d.ts +3 -2
- package/esm/object/ANotB.d.ts.map +1 -1
- package/esm/object/Required.d.ts +1 -1
- package/esm/object/Required.d.ts.map +1 -1
- package/esm/object/findKey.d.ts +1 -1
- package/esm/object/findKey.d.ts.map +1 -1
- package/esm/object/forEachKey.d.ts +1 -1
- package/esm/object/forEachKey.d.ts.map +1 -1
- package/esm/object/hasProperty.d.ts +1 -1
- package/esm/object/hasProperty.d.ts.map +1 -1
- package/esm/object/object_type.d.ts +1 -1
- package/esm/object/object_type.d.ts.map +1 -1
- package/esm/object/split.d.ts +1 -1
- package/esm/object/split.d.ts.map +1 -1
- package/esm/primitive.d.ts +3 -0
- package/esm/primitive.d.ts.map +1 -1
- package/esm/string/string_type.d.ts +1 -1
- package/esm/string/string_type.d.ts.map +1 -1
- package/esm/symbol/symbol_type.d.ts +1 -1
- package/esm/symbol/symbol_type.d.ts.map +1 -1
- package/esm/testing/stub.d.ts +3 -0
- package/esm/testing/stub.d.ts.map +1 -1
- package/esm/testing/stub.js.map +1 -1
- package/esm/type/failed.d.ts +1 -1
- package/esm/type/failed.d.ts.map +1 -1
- package/esm/type/no_infer.d.ts +9 -6
- package/esm/type/no_infer.d.ts.map +1 -1
- package/esm/type-guard/is_type.d.ts +1 -1
- package/esm/type-guard/is_type.js +1 -1
- package/esm/type-guard/is_type.js.map +1 -1
- package/esm/unpartial.d.ts +2 -0
- package/esm/unpartial.d.ts.map +1 -0
- package/esm/unpartial.js +2 -0
- package/esm/unpartial.js.map +1 -0
- package/esm/void/void_type.d.ts +1 -1
- package/esm/void/void_type.d.ts.map +1 -1
- package/package.json +17 -28
- package/ts/any/any_type.ts +17 -7
- package/ts/array/array.some.ts +18 -4
- package/ts/array/array_plus.split_at.ts +1 -1
- package/ts/array/reduce_while.ts +1 -1
- package/ts/assertion/assert_type.ts +7 -4
- package/ts/bigint/bigint_type.ts +1 -1
- package/ts/bigint/strict_bigint_type.ts +1 -1
- package/ts/boolean/boolean_type.ts +1 -1
- package/ts/boolean/false_type.ts +1 -1
- package/ts/boolean/strict_boolean_type.ts +1 -1
- package/ts/boolean/true_type.ts +1 -1
- package/ts/equal/equal.ts +18 -18
- package/ts/function/function_type.ts +1 -1
- package/ts/function/strict_function_type.ts +1 -1
- package/ts/functional/context.ts +1 -1
- package/ts/index.ts +3 -2
- package/ts/mix_types/any_or_never_type.ts +30 -0
- package/ts/number/number_type.ts +1 -1
- package/ts/numeric/integer.ts +1 -1
- package/ts/numeric/numeric_type.ts +1 -1
- package/ts/object/ANotB.ts +2 -1
- package/ts/object/Required.ts +1 -1
- package/ts/object/findKey.ts +1 -1
- package/ts/object/forEachKey.ts +1 -1
- package/ts/object/hasProperty.ts +1 -1
- package/ts/object/object_type.ts +1 -1
- package/ts/object/split.ts +1 -1
- package/ts/primitive.ts +3 -0
- package/ts/string/string_type.ts +1 -1
- package/ts/symbol/symbol_type.ts +1 -1
- package/ts/testing/stub.ts +3 -0
- package/ts/type/failed.ts +1 -1
- package/ts/type/no_infer.ts +9 -6
- package/ts/type-guard/is_type.ts +2 -2
- package/ts/unpartial.ts +1 -0
- package/ts/void/void_type.ts +1 -1
- package/cjs/any/any_or_never.d.ts +0 -15
- package/cjs/any/any_or_never.d.ts.map +0 -1
- package/cjs/any/any_or_never.js.map +0 -1
- package/esm/any/any_or_never.d.ts +0 -15
- package/esm/any/any_or_never.d.ts.map +0 -1
- package/esm/any/any_or_never.js +0 -2
- package/esm/any/any_or_never.js.map +0 -1
- package/ts/any/any_or_never.ts +0 -15
package/ts/primitive.ts
CHANGED
package/ts/string/string_type.ts
CHANGED
package/ts/symbol/symbol_type.ts
CHANGED
package/ts/testing/stub.ts
CHANGED
|
@@ -5,7 +5,10 @@ import type { NoInfer } from '../type/no_infer.js'
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* stub a value.
|
|
8
|
+
*
|
|
8
9
|
* If the value is a function, it will be passed through as-is.
|
|
10
|
+
*
|
|
11
|
+
* 🦴 `utilities`
|
|
9
12
|
*/
|
|
10
13
|
export function stub<T extends AnyFunction>(stub: T): T
|
|
11
14
|
export function stub<T>(stub: RecursivePartial<NoInfer<T>>): T
|
package/ts/type/failed.ts
CHANGED
|
@@ -27,6 +27,6 @@ export interface Failed<Msg extends string> {
|
|
|
27
27
|
*
|
|
28
28
|
* It's recommended to create custom failed types instead of using this to provide better message.
|
|
29
29
|
*/
|
|
30
|
-
export interface FailedT<Msg extends string,
|
|
30
|
+
export interface FailedT<Msg extends string, _T> {
|
|
31
31
|
[uniSym]: Msg
|
|
32
32
|
}
|
package/ts/type/no_infer.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IsNull } from '../null/null_type.js'
|
|
2
|
-
import { Or } from '../predicates/logical.js'
|
|
3
|
-
import { IsUndefined } from '../undefined/undefined_type.js'
|
|
1
|
+
import type { IsNull } from '../null/null_type.js'
|
|
2
|
+
import type { Or } from '../predicates/logical.js'
|
|
3
|
+
import type { IsUndefined } from '../undefined/undefined_type.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Prevents inference of a type parameter `T`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/microsoft/TypeScript/pull/52968
|
|
8
|
+
* 🦴 *utilities*
|
|
10
9
|
*
|
|
11
|
-
* @
|
|
10
|
+
* @ajafff original version author
|
|
11
|
+
* @see https://github.com/microsoft/TypeScript/issues/14829#issuecomment-298425341
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
@@ -20,5 +20,8 @@ import { IsUndefined } from '../undefined/undefined_type.js'
|
|
|
20
20
|
* assertEqual(123, 'abc') // Error
|
|
21
21
|
* assertEqual({ x: 1 }, { x: 1, y: 2 }) // Error
|
|
22
22
|
* ```
|
|
23
|
+
*
|
|
24
|
+
* A build-in `NoInfer` is coming soon.
|
|
25
|
+
* @see https://github.com/microsoft/TypeScript/pull/52968
|
|
23
26
|
*/
|
|
24
27
|
export type NoInfer<T> = Or<IsNull<T>, IsUndefined<T>, T, T & {}>
|
package/ts/type-guard/is_type.ts
CHANGED
|
@@ -36,7 +36,7 @@ function isNever<S extends never>(): unknown
|
|
|
36
36
|
* @deprecated use `isType<T>()` or `testType.never<T>()` instead
|
|
37
37
|
*/
|
|
38
38
|
function isNever(subject: never): subject is never
|
|
39
|
-
function isNever(
|
|
39
|
+
function isNever(_subject?: unknown): _subject is never {
|
|
40
40
|
return true
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -49,4 +49,4 @@ isType.never = isNever
|
|
|
49
49
|
*
|
|
50
50
|
* @deprecated use `testType.equal()` instead
|
|
51
51
|
*/
|
|
52
|
-
isType.equal = function <
|
|
52
|
+
isType.equal = function <_C extends IsEqual<A, B>, A, B>() {}
|
package/ts/unpartial.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { required, requiredDeep, unpartial } from 'unpartial'
|
package/ts/void/void_type.ts
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IsNever } from '../never/never_type.js';
|
|
2
|
-
import type { IsAny } from './any_type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Is `T` type `any` or `never`.
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* type R = IsAnyOrNever<any> // true
|
|
8
|
-
* type R = IsAnyOrNever<never> // true
|
|
9
|
-
*
|
|
10
|
-
* type R = IsAnyOrNever<1> // false
|
|
11
|
-
* type R = IsAnyOrNever<unknown> // false
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>;
|
|
15
|
-
//# sourceMappingURL=any_or_never.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"any_or_never.d.ts","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"any_or_never.js","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IsNever } from '../never/never_type.js';
|
|
2
|
-
import type { IsAny } from './any_type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Is `T` type `any` or `never`.
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* type R = IsAnyOrNever<any> // true
|
|
8
|
-
* type R = IsAnyOrNever<never> // true
|
|
9
|
-
*
|
|
10
|
-
* type R = IsAnyOrNever<1> // false
|
|
11
|
-
* type R = IsAnyOrNever<unknown> // false
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>;
|
|
15
|
-
//# sourceMappingURL=any_or_never.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"any_or_never.d.ts","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
|
package/esm/any/any_or_never.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"any_or_never.js","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":""}
|
package/ts/any/any_or_never.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IsNever } from '../never/never_type.js'
|
|
2
|
-
import type { IsAny } from './any_type.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Is `T` type `any` or `never`.
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* type R = IsAnyOrNever<any> // true
|
|
9
|
-
* type R = IsAnyOrNever<never> // true
|
|
10
|
-
*
|
|
11
|
-
* type R = IsAnyOrNever<1> // false
|
|
12
|
-
* type R = IsAnyOrNever<unknown> // false
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>
|