type-plus 8.0.0-beta.4 → 8.0.0-beta.6
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/cjs/array/is_array.d.ts +4 -4
- package/cjs/array/is_array.d.ts.map +1 -1
- package/cjs/array/is_not_array.d.ts +4 -4
- package/cjs/array/is_not_array.d.ts.map +1 -1
- package/cjs/array/literal_array.js +2 -1
- package/cjs/array/literal_array.js.map +1 -1
- package/cjs/array/reduce_while.js +2 -1
- package/cjs/array/reduce_while.js.map +1 -1
- package/cjs/assertion/assert_type.d.ts +1 -1
- package/cjs/assertion/assert_type.d.ts.map +1 -1
- package/cjs/assertion/assert_type.js +2 -1
- package/cjs/assertion/assert_type.js.map +1 -1
- package/cjs/bigint/is_bigint.d.ts +4 -4
- package/cjs/bigint/is_bigint.d.ts.map +1 -1
- package/cjs/bigint/is_not_bigint.d.ts +3 -3
- package/cjs/bigint/is_not_bigint.d.ts.map +1 -1
- package/cjs/boolean/is_boolean.d.ts +4 -4
- package/cjs/boolean/is_boolean.d.ts.map +1 -1
- package/cjs/boolean/is_not_boolean.d.ts +3 -3
- package/cjs/boolean/is_not_boolean.d.ts.map +1 -1
- package/cjs/class/isConstructor.js +3 -2
- package/cjs/class/isConstructor.js.map +1 -1
- package/cjs/function/extract_function.d.ts.map +1 -1
- package/cjs/function/extract_function.js +2 -1
- package/cjs/function/extract_function.js.map +1 -1
- package/cjs/functional/Maybe.js +3 -2
- package/cjs/functional/Maybe.js.map +1 -1
- package/cjs/functional/compose.js +2 -1
- package/cjs/functional/compose.js.map +1 -1
- package/cjs/functional/context.js +2 -1
- package/cjs/functional/context.js.map +1 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/mix_types/merge.js +2 -1
- package/cjs/mix_types/merge.js.map +1 -1
- package/cjs/nodejs/isNodeError.js +2 -1
- package/cjs/nodejs/isNodeError.js.map +1 -1
- package/cjs/nominal/brand.js +2 -1
- package/cjs/nominal/brand.js.map +1 -1
- package/cjs/nominal/flavor.js +2 -1
- package/cjs/nominal/flavor.js.map +1 -1
- package/cjs/nominal/nominal_match.js +2 -1
- package/cjs/nominal/nominal_match.js.map +1 -1
- package/cjs/number/is_not_number.d.ts +3 -3
- package/cjs/number/is_not_number.d.ts.map +1 -1
- package/cjs/number/is_number.d.ts +3 -3
- package/cjs/number/is_number.d.ts.map +1 -1
- package/cjs/object/adjust_exact_optional_props.d.ts +16 -0
- package/cjs/object/adjust_exact_optional_props.d.ts.map +1 -0
- package/cjs/object/adjust_exact_optional_props.js +3 -0
- package/cjs/object/adjust_exact_optional_props.js.map +1 -0
- package/cjs/object/everyKey.js +2 -1
- package/cjs/object/everyKey.js.map +1 -1
- package/cjs/object/facade.js +2 -1
- package/cjs/object/facade.js.map +1 -1
- package/cjs/object/filterKey.js +2 -1
- package/cjs/object/filterKey.js.map +1 -1
- package/cjs/object/findKey.js +2 -1
- package/cjs/object/findKey.js.map +1 -1
- package/cjs/object/forEachKey.js +2 -1
- package/cjs/object/forEachKey.js.map +1 -1
- package/cjs/object/getField.js +2 -1
- package/cjs/object/getField.js.map +1 -1
- package/cjs/object/hasKey.js +2 -1
- package/cjs/object/hasKey.js.map +1 -1
- package/cjs/object/hasProperty.js +2 -1
- package/cjs/object/hasProperty.js.map +1 -1
- package/cjs/object/index.d.ts +1 -0
- package/cjs/object/index.d.ts.map +1 -1
- package/cjs/object/index.js.map +1 -1
- package/cjs/object/is_not_object.d.ts +4 -4
- package/cjs/object/is_not_object.d.ts.map +1 -1
- package/cjs/object/is_object.d.ts +4 -4
- package/cjs/object/is_object.d.ts.map +1 -1
- package/cjs/object/mapKey.js +2 -1
- package/cjs/object/mapKey.js.map +1 -1
- package/cjs/object/mapProperties.js +2 -1
- package/cjs/object/mapProperties.js.map +1 -1
- package/cjs/object/omit.js +2 -1
- package/cjs/object/omit.js.map +1 -1
- package/cjs/object/pick.js +2 -1
- package/cjs/object/pick.js.map +1 -1
- package/cjs/object/record.js +2 -1
- package/cjs/object/record.js.map +1 -1
- package/cjs/object/reduceKey.js +2 -2
- package/cjs/object/reduceKey.js.map +1 -1
- package/cjs/object/replaceProperty.js +2 -1
- package/cjs/object/replaceProperty.js.map +1 -1
- package/cjs/object/someKey.js +2 -1
- package/cjs/object/someKey.js.map +1 -1
- package/cjs/object/split.js +2 -1
- package/cjs/object/split.js.map +1 -1
- package/cjs/object/typeOverrideIncompatible.d.ts.map +1 -1
- package/cjs/object/typeOverrideIncompatible.js +2 -1
- package/cjs/object/typeOverrideIncompatible.js.map +1 -1
- package/cjs/predicates/CanAssign.js +2 -1
- package/cjs/predicates/CanAssign.js.map +1 -1
- package/cjs/promise/MaybePromise.js +2 -2
- package/cjs/promise/MaybePromise.js.map +1 -1
- package/cjs/promise/isPromise.js +2 -1
- package/cjs/promise/isPromise.js.map +1 -1
- package/cjs/promise/mapSeries.js +2 -1
- package/cjs/promise/mapSeries.js.map +1 -1
- package/cjs/string/is_not_string.d.ts +3 -3
- package/cjs/string/is_not_string.d.ts.map +1 -1
- package/cjs/string/is_not_string_literal.d.ts +4 -4
- package/cjs/string/is_not_string_literal.d.ts.map +1 -1
- package/cjs/string/is_string.d.ts +3 -3
- package/cjs/string/is_string.d.ts.map +1 -1
- package/cjs/string/is_string_literal.d.ts +4 -4
- package/cjs/string/is_string_literal.d.ts.map +1 -1
- package/cjs/testing/stub.d.ts +2 -2
- package/cjs/testing/stub.d.ts.map +1 -1
- package/cjs/testing/stub.js +2 -1
- package/cjs/testing/stub.js.map +1 -1
- package/cjs/tuple/drop.js +2 -1
- package/cjs/tuple/drop.js.map +1 -1
- package/cjs/type-guard/is_type.d.ts +2 -2
- package/cjs/type-guard/is_type.d.ts.map +1 -1
- package/cjs/type-guard/is_type.js +2 -1
- package/cjs/type-guard/is_type.js.map +1 -1
- package/cjs/type_plus/branch/$exact.d.ts +13 -22
- package/cjs/type_plus/branch/$exact.d.ts.map +1 -1
- package/cjs/type_plus/branch/$select.d.ts +3 -3
- package/cjs/type_plus/branch/$select.d.ts.map +1 -1
- package/cjs/union/sub_union.d.ts +6 -0
- package/cjs/union/sub_union.d.ts.map +1 -0
- package/cjs/union/sub_union.js +3 -0
- package/cjs/union/sub_union.js.map +1 -0
- package/cjs/union/union_to_intersection.js +2 -1
- package/cjs/union/union_to_intersection.js.map +1 -1
- package/cjs/utils/as.d.ts +1 -1
- package/cjs/utils/as.d.ts.map +1 -1
- package/cjs/utils/as.js +4 -3
- package/cjs/utils/as.js.map +1 -1
- package/cjs/utils/inspect.js +2 -1
- package/cjs/utils/inspect.js.map +1 -1
- package/esm/array/is_array.d.ts +4 -4
- package/esm/array/is_array.d.ts.map +1 -1
- package/esm/array/is_not_array.d.ts +4 -4
- package/esm/array/is_not_array.d.ts.map +1 -1
- package/esm/assertion/assert_type.d.ts +1 -1
- package/esm/assertion/assert_type.d.ts.map +1 -1
- package/esm/bigint/is_bigint.d.ts +4 -4
- package/esm/bigint/is_bigint.d.ts.map +1 -1
- package/esm/bigint/is_not_bigint.d.ts +3 -3
- package/esm/bigint/is_not_bigint.d.ts.map +1 -1
- package/esm/boolean/is_boolean.d.ts +4 -4
- package/esm/boolean/is_boolean.d.ts.map +1 -1
- package/esm/boolean/is_not_boolean.d.ts +3 -3
- package/esm/boolean/is_not_boolean.d.ts.map +1 -1
- package/esm/function/extract_function.d.ts.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/number/is_not_number.d.ts +3 -3
- package/esm/number/is_not_number.d.ts.map +1 -1
- package/esm/number/is_number.d.ts +3 -3
- package/esm/number/is_number.d.ts.map +1 -1
- package/esm/object/adjust_exact_optional_props.d.ts +16 -0
- package/esm/object/adjust_exact_optional_props.d.ts.map +1 -0
- package/esm/object/adjust_exact_optional_props.js +2 -0
- package/esm/object/adjust_exact_optional_props.js.map +1 -0
- package/esm/object/index.d.ts +1 -0
- package/esm/object/index.d.ts.map +1 -1
- package/esm/object/index.js.map +1 -1
- package/esm/object/is_not_object.d.ts +4 -4
- package/esm/object/is_not_object.d.ts.map +1 -1
- package/esm/object/is_object.d.ts +4 -4
- package/esm/object/is_object.d.ts.map +1 -1
- package/esm/object/typeOverrideIncompatible.d.ts.map +1 -1
- package/esm/string/is_not_string.d.ts +3 -3
- package/esm/string/is_not_string.d.ts.map +1 -1
- package/esm/string/is_not_string_literal.d.ts +4 -4
- package/esm/string/is_not_string_literal.d.ts.map +1 -1
- package/esm/string/is_string.d.ts +3 -3
- package/esm/string/is_string.d.ts.map +1 -1
- package/esm/string/is_string_literal.d.ts +4 -4
- package/esm/string/is_string_literal.d.ts.map +1 -1
- package/esm/testing/stub.d.ts +2 -2
- package/esm/testing/stub.d.ts.map +1 -1
- package/esm/type-guard/is_type.d.ts +2 -2
- package/esm/type-guard/is_type.d.ts.map +1 -1
- package/esm/type_plus/branch/$exact.d.ts +13 -22
- package/esm/type_plus/branch/$exact.d.ts.map +1 -1
- package/esm/type_plus/branch/$select.d.ts +3 -3
- package/esm/type_plus/branch/$select.d.ts.map +1 -1
- package/esm/union/sub_union.d.ts +6 -0
- package/esm/union/sub_union.d.ts.map +1 -0
- package/esm/union/sub_union.js +2 -0
- package/esm/union/sub_union.js.map +1 -0
- package/esm/utils/as.d.ts +1 -1
- package/esm/utils/as.d.ts.map +1 -1
- package/package.json +16 -21
- package/readme.md +25 -24
- package/src/array/is_array.ts +4 -4
- package/src/array/is_not_array.ts +4 -4
- package/src/bigint/is_bigint.ts +4 -4
- package/src/bigint/is_not_bigint.ts +3 -3
- package/src/boolean/is_boolean.ts +4 -4
- package/src/boolean/is_not_boolean.ts +3 -3
- package/src/index.ts +2 -1
- package/src/number/is_not_number.ts +3 -3
- package/src/number/is_number.ts +3 -3
- package/src/object/adjust_exact_optional_props.ts +14 -0
- package/src/object/index.ts +1 -0
- package/src/object/is_not_object.ts +4 -4
- package/src/object/is_object.ts +4 -4
- package/src/string/is_not_string.ts +3 -3
- package/src/string/is_not_string_literal.ts +4 -4
- package/src/string/is_string.ts +3 -3
- package/src/string/is_string_literal.ts +4 -4
- package/src/type_plus/branch/$exact.ts +18 -28
- package/src/type_plus/branch/$select.ts +3 -3
- package/src/union/sub_union.ts +5 -0
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -79,7 +79,7 @@ export type IsNotBigint<T, $O extends IsNotBigint.$Options = {}> = $SpecialType<
|
|
|
79
79
|
>
|
|
80
80
|
|
|
81
81
|
export namespace IsNotBigint {
|
|
82
|
-
export type $Options = $Equality.$Options & $
|
|
82
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
83
83
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
84
84
|
|
|
85
85
|
/**
|
|
@@ -93,7 +93,7 @@ export namespace IsNotBigint {
|
|
|
93
93
|
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
94
94
|
? $IsDistributive<$O, { $then: _SD<T, $O>; $else: _SN<T, $O> }>
|
|
95
95
|
: NotAssignable.$<T, bigint, $O>
|
|
96
|
-
export type $UtilOptions = NotAssignable.$UtilOptions & $
|
|
96
|
+
export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
|
|
97
97
|
|
|
98
98
|
export type _SD<T, $O extends $Options> = T extends bigint & infer U
|
|
99
99
|
? U extends bigint
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -70,7 +70,7 @@ export type IsBoolean<T, $O extends IsBoolean.$Options = {}> = $SpecialType<
|
|
|
70
70
|
>
|
|
71
71
|
>
|
|
72
72
|
export namespace IsBoolean {
|
|
73
|
-
export type $Options = $Equality.$Options & $
|
|
73
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
74
74
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -81,10 +81,10 @@ export namespace IsBoolean {
|
|
|
81
81
|
* This is a type util for building custom types.
|
|
82
82
|
* It does not check against special types.
|
|
83
83
|
*/
|
|
84
|
-
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $
|
|
84
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
|
|
85
85
|
? $IsDistributive<$O, { $then: _SD<T, $O>; $else: _N<T, $O> }>
|
|
86
86
|
: Assignable.$<T, boolean, $O>
|
|
87
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
87
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
88
88
|
|
|
89
89
|
export type _SD<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
|
|
90
90
|
? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -72,7 +72,7 @@ export type IsNotBoolean<T, $O extends IsNotBoolean.$Options = {}> = $SpecialTyp
|
|
|
72
72
|
>
|
|
73
73
|
|
|
74
74
|
export namespace IsNotBoolean {
|
|
75
|
-
export type $Options = $Equality.$Options & $
|
|
75
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
76
76
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -86,7 +86,7 @@ export namespace IsNotBoolean {
|
|
|
86
86
|
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
87
87
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
88
88
|
: NotAssignable.$<T, boolean, $O>
|
|
89
|
-
export type $UtilOptions = NotAssignable.$UtilOptions & $
|
|
89
|
+
export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
|
|
90
90
|
|
|
91
91
|
export type _D<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
|
|
92
92
|
? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
|
package/src/index.ts
CHANGED
|
@@ -73,11 +73,11 @@ export type * from './numeric/is_numeric.js'
|
|
|
73
73
|
export type * from './numeric/is_positive.js'
|
|
74
74
|
export * as NumericPlus from './numeric/numeric_plus.js'
|
|
75
75
|
export type * from './numeric/numeric_type.js'
|
|
76
|
-
export type { Required, RequiredExcept, RequiredPick } from './object/Required.js'
|
|
77
76
|
export * from './object/index.js'
|
|
78
77
|
export type * from './object/is_not_object.js'
|
|
79
78
|
export type * from './object/is_object.js'
|
|
80
79
|
export * as ObjectPlus from './object/object_plus.js'
|
|
80
|
+
export type { Required, RequiredExcept, RequiredPick } from './object/Required.js'
|
|
81
81
|
export type * from './predicates/assignable.js'
|
|
82
82
|
export * from './predicates/index.js'
|
|
83
83
|
export type * from './predicates/not_assignable.js'
|
|
@@ -125,6 +125,7 @@ export type * from './type_plus/branch/$selection_options.js'
|
|
|
125
125
|
export type * from './undefined/has_undefined.js'
|
|
126
126
|
export type * from './undefined/is_not_undefined.js'
|
|
127
127
|
export type * from './undefined/is_undefined.js'
|
|
128
|
+
export type * from './union/sub_union.js'
|
|
128
129
|
export type { IsUnion, UnionType } from './union/union.js'
|
|
129
130
|
export type { UnionKeys } from './union_keys.js'
|
|
130
131
|
export type * from './unknown/is_not_unknown.js'
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -69,7 +69,7 @@ export type IsNotNumber<T, $O extends IsNotNumber.$Options = {}> = $SpecialType<
|
|
|
69
69
|
>
|
|
70
70
|
|
|
71
71
|
export namespace IsNotNumber {
|
|
72
|
-
export type $Options = $Equality.$Options & $
|
|
72
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
73
73
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -83,7 +83,7 @@ export namespace IsNotNumber {
|
|
|
83
83
|
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
84
84
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
85
85
|
: NotAssignable.$<T, number, $O>
|
|
86
|
-
export type $UtilOptions = NotAssignable.$UtilOptions & $
|
|
86
|
+
export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
|
|
87
87
|
export type _D<T, $O extends IsNotNumber.$Options> = T extends number & infer U
|
|
88
88
|
? U extends number
|
|
89
89
|
? $ResolveBranch<T, $O, [$Then]>
|
package/src/number/is_number.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -72,7 +72,7 @@ export type IsNumber<T, $O extends IsNumber.$Options = {}> = $SpecialType<
|
|
|
72
72
|
>
|
|
73
73
|
|
|
74
74
|
export namespace IsNumber {
|
|
75
|
-
export type $Options = $Equality.$Options & $
|
|
75
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
76
76
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -86,7 +86,7 @@ export namespace IsNumber {
|
|
|
86
86
|
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
87
87
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
88
88
|
: Assignable.$<T, number, $O>
|
|
89
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
89
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
90
90
|
|
|
91
91
|
export type _D<T, $O extends $UtilOptions> = T extends number & infer U
|
|
92
92
|
? U extends number
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AnyRecord } from './any_record.js'
|
|
2
|
+
import type { OptionalKeys } from './optional_key.js'
|
|
3
|
+
import type { RequiredKeys } from './RequiredKeys.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ⚗️ *transform*
|
|
7
|
+
*
|
|
8
|
+
* Adjust `T` to work with compiler flag [exactOptionalPropertyTypes](https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes).
|
|
9
|
+
*
|
|
10
|
+
* It adds `undefined` to optional properties.
|
|
11
|
+
*/
|
|
12
|
+
export type AdjustExactOptionalProps<T extends AnyRecord> = T extends object
|
|
13
|
+
? { [K in OptionalKeys<T>]?: T[K] | undefined } & { [K in RequiredKeys<T>]: T[K] }
|
|
14
|
+
: never
|
package/src/object/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
5
5
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
6
6
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
7
7
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
8
|
-
import type { $
|
|
8
|
+
import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
9
9
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
10
10
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
11
11
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -100,7 +100,7 @@ export type IsNotObject<T, $O extends IsNotObject.$Options = {}> = $SpecialType<
|
|
|
100
100
|
>
|
|
101
101
|
>
|
|
102
102
|
export namespace IsNotObject {
|
|
103
|
-
export type $Options = $Equality.$Options & $
|
|
103
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
104
104
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
105
105
|
|
|
106
106
|
/**
|
|
@@ -111,10 +111,10 @@ export namespace IsNotObject {
|
|
|
111
111
|
* This is a type util for building custom types.
|
|
112
112
|
* It does not check against special types.
|
|
113
113
|
*/
|
|
114
|
-
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $
|
|
114
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
|
|
115
115
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
116
116
|
: NotAssignable.$<T, object, $O>
|
|
117
|
-
export type $UtilOptions = NotAssignable.$UtilOptions & $
|
|
117
|
+
export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
|
|
118
118
|
|
|
119
119
|
export type _D<T, $O extends $UtilOptions> = T extends object
|
|
120
120
|
? IdentityEqual<
|
package/src/object/is_object.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
5
5
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
6
6
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
7
7
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
8
|
-
import type { $
|
|
8
|
+
import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
9
9
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
10
10
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
11
11
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -88,7 +88,7 @@ export type IsObject<T, $O extends IsObject.$Options = {}> = $SpecialType<
|
|
|
88
88
|
>
|
|
89
89
|
|
|
90
90
|
export namespace IsObject {
|
|
91
|
-
export type $Options = $Equality.$Options & $
|
|
91
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
92
92
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -99,10 +99,10 @@ export namespace IsObject {
|
|
|
99
99
|
* This is a type util for building custom types.
|
|
100
100
|
* It does not check against special types.
|
|
101
101
|
*/
|
|
102
|
-
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $
|
|
102
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
|
|
103
103
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
104
104
|
: Assignable.$<T, object, $O>
|
|
105
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
105
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
106
106
|
|
|
107
107
|
export type _D<T, $O extends $UtilOptions> = T extends object
|
|
108
108
|
? IdentityEqual<
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -69,7 +69,7 @@ export type IsNotString<T, $O extends IsNotString.$Options = {}> = $SpecialType<
|
|
|
69
69
|
>
|
|
70
70
|
|
|
71
71
|
export namespace IsNotString {
|
|
72
|
-
export type $Options = $Equality.$Options & $
|
|
72
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
73
73
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -83,7 +83,7 @@ export namespace IsNotString {
|
|
|
83
83
|
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
84
84
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
85
85
|
: NotAssignable.$<T, string, $O>
|
|
86
|
-
export type $UtilOptions = NotAssignable.$UtilOptions & $
|
|
86
|
+
export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
|
|
87
87
|
|
|
88
88
|
export type _D<T, $O extends $SelectionOptions> = T extends string & infer U
|
|
89
89
|
? U extends string
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -80,7 +80,7 @@ export type IsNotStringLiteral<T, $O extends IsNotStringLiteral.$Options = {}> =
|
|
|
80
80
|
>
|
|
81
81
|
|
|
82
82
|
export namespace IsNotStringLiteral {
|
|
83
|
-
export type $Options = $Equality.$Options & $
|
|
83
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
84
84
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -91,11 +91,11 @@ export namespace IsNotStringLiteral {
|
|
|
91
91
|
* This is a type util for building custom types.
|
|
92
92
|
* It does not check against special types.
|
|
93
93
|
*/
|
|
94
|
-
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $
|
|
94
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
|
|
95
95
|
? $IsDistributive<$O, { $then: _ED<T, $O>; $else: _EN<T, $O> }>
|
|
96
96
|
: $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
97
97
|
|
|
98
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
98
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
99
99
|
|
|
100
100
|
export type _ED<T, $O extends $SelectionOptions> = T extends string ? _E<T, $O> : $ResolveBranch<T, $O, [$Then]>
|
|
101
101
|
|
package/src/string/is_string.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -68,7 +68,7 @@ export type IsString<T, $O extends IsString.$Options = {}> = $SpecialType<
|
|
|
68
68
|
>
|
|
69
69
|
|
|
70
70
|
export namespace IsString {
|
|
71
|
-
export type $Options = $Equality.$Options & $
|
|
71
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
72
72
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -83,7 +83,7 @@ export namespace IsString {
|
|
|
83
83
|
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
84
84
|
: Assignable.$<T, string, $O>
|
|
85
85
|
|
|
86
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
86
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
87
87
|
|
|
88
88
|
export type _D<T, $O extends $UtilOptions> = T extends string & infer U
|
|
89
89
|
? U extends string
|
|
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
|
|
|
3
3
|
import type { $MergeOptions } from '../type_plus/$merge_options.js'
|
|
4
4
|
import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
|
|
5
5
|
import type { $SpecialType } from '../type_plus/$special_type.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
|
|
7
7
|
import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
|
|
8
8
|
import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
|
|
9
9
|
import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
@@ -80,7 +80,7 @@ export type IsStringLiteral<T, $O extends IsStringLiteral.$Options = {}> = $Spec
|
|
|
80
80
|
>
|
|
81
81
|
|
|
82
82
|
export namespace IsStringLiteral {
|
|
83
|
-
export type $Options = $Equality.$Options & $
|
|
83
|
+
export type $Options = $Equality.$Options & $ExactOptions
|
|
84
84
|
export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -91,11 +91,11 @@ export namespace IsStringLiteral {
|
|
|
91
91
|
* This is a type util for building custom types.
|
|
92
92
|
* It does not check against special types.
|
|
93
93
|
*/
|
|
94
|
-
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $
|
|
94
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
|
|
95
95
|
? $IsDistributive<$O, { $then: _ED<T, $O>; $else: _EN<T, $O> }>
|
|
96
96
|
: $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
97
97
|
|
|
98
|
-
export type $UtilOptions = Assignable.$UtilOptions & $
|
|
98
|
+
export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
|
|
99
99
|
|
|
100
100
|
export type _ED<T, $O extends $SelectionOptions> = T extends string ? _E<T, $O> : $ResolveBranch<T, $O, [$Else]>
|
|
101
101
|
|
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import type { $ResolveOptions } from '../$resolve_options.js'
|
|
2
|
-
import type { $Branch } from './$branch.js'
|
|
3
2
|
import type { $InputOptions } from './$input_options.js'
|
|
4
3
|
import type { $Else, $Then } from './$selection.js'
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* 🧰 *type util*
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* `$Exact.$Options` enables customizing the behavior of the `$exact` branch.
|
|
9
|
+
*
|
|
10
|
+
* The `$exact` branch is used to handle when it is an exact comparison.
|
|
10
11
|
*/
|
|
11
|
-
export type $
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 🧰 *type util*
|
|
16
|
-
*
|
|
17
|
-
* `$Exact.$Options` enables customizing the behavior of the `$exact` branch.
|
|
18
|
-
*
|
|
19
|
-
* The `$exact` branch is used to handle when it is an exact comparison.
|
|
20
|
-
*/
|
|
21
|
-
export type $Options = {
|
|
22
|
-
exact?: boolean | undefined
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type $Default = {
|
|
26
|
-
exact: false
|
|
27
|
-
}
|
|
12
|
+
export type $ExactOptions = {
|
|
13
|
+
exact?: boolean | undefined
|
|
14
|
+
}
|
|
28
15
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
> extends true
|
|
32
|
-
? '$then' extends keyof $O
|
|
33
|
-
? $O['$then']
|
|
34
|
-
: true
|
|
35
|
-
: '$else' extends keyof $O
|
|
36
|
-
? $O['$else']
|
|
37
|
-
: false
|
|
16
|
+
export type $ExactDefault = {
|
|
17
|
+
exact: false
|
|
38
18
|
}
|
|
19
|
+
|
|
20
|
+
export type $IsExact<$Opt extends $ExactOptions, $O extends $InputOptions<$Then | $Else> = {}> = $ResolveOptions<
|
|
21
|
+
[$Opt['exact'], $ExactDefault]
|
|
22
|
+
> extends true
|
|
23
|
+
? '$then' extends keyof $O
|
|
24
|
+
? $O['$then']
|
|
25
|
+
: true
|
|
26
|
+
: '$else' extends keyof $O
|
|
27
|
+
? $O['$else']
|
|
28
|
+
: false
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { $SpecialType } from '../$special_type.js'
|
|
1
2
|
import type { $Any } from '../../any/any.js'
|
|
2
3
|
import type { $Never } from '../../never/never.js'
|
|
3
4
|
import type { $Unknown } from '../../unknown/unknown.js'
|
|
4
|
-
import type { $SpecialType } from '../$special_type.js'
|
|
5
5
|
import type { $DistributiveDefault, $DistributiveOptions } from './$distributive.js'
|
|
6
|
-
import type { $
|
|
6
|
+
import type { $ExactOptions } from './$exact.js'
|
|
7
7
|
import type { $InputOptions } from './$input_options.js'
|
|
8
8
|
import type { $IsDistributive } from './$is_distributive.js'
|
|
9
9
|
import type { $ResolveBranch } from './$resolve_branch.js'
|
|
@@ -75,7 +75,7 @@ export namespace $Select {
|
|
|
75
75
|
export type $Options = $SelectionOptions &
|
|
76
76
|
$DistributiveOptions &
|
|
77
77
|
$InputOptions<$Any | $Unknown | $Never> &
|
|
78
|
-
$
|
|
78
|
+
$ExactOptions
|
|
79
79
|
export type $Default = $SelectionPredicate & $DistributiveDefault
|
|
80
80
|
export type $Branch<$O extends $DistributiveOptions = $DistributiveDefault> = $SelectionBranch & $O
|
|
81
81
|
export type _<T, U, $O extends $Select.$Options> = $IsDistributive<$O> extends true ? _D<T, U, $O> : _N<T, U, $O>
|