type-plus 8.0.0-beta.2 → 8.0.0-beta.3
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/esm/any/is_any.d.ts.map +1 -1
- package/esm/any/is_not_any.d.ts.map +1 -1
- package/esm/array/array.at.d.ts.map +1 -1
- package/esm/array/array.entries.d.ts +1 -1
- package/esm/array/array.entries.d.ts.map +1 -1
- package/esm/array/array.find_last.d.ts +1 -1
- package/esm/array/array.find_last.d.ts.map +1 -1
- package/esm/array/array.reverse.d.ts.map +1 -1
- package/esm/array/array.some.d.ts +2 -2
- package/esm/array/array.some.d.ts.map +1 -1
- package/esm/array/array_plus.common_prop_keys.d.ts.map +1 -1
- package/esm/array/array_plus.drop_match.d.ts +1 -1
- package/esm/array/array_plus.drop_match.d.ts.map +1 -1
- package/esm/array/array_plus.element_match.d.ts +4 -2
- package/esm/array/array_plus.element_match.d.ts.map +1 -1
- package/esm/array/array_plus.filter.d.ts +4 -4
- package/esm/array/array_plus.filter.d.ts.map +1 -1
- package/esm/array/array_plus.find.d.ts +1 -1
- package/esm/array/array_plus.find.d.ts.map +1 -1
- package/esm/array/array_plus.index_at.d.ts.map +1 -1
- package/esm/array/array_plus.index_at.js.map +1 -1
- package/esm/array/array_plus.is_index_out_of_bound.d.ts.map +1 -1
- package/esm/array/array_plus.is_readonly.d.ts.map +1 -1
- package/esm/array/array_plus.pad_start.d.ts.map +1 -1
- package/esm/array/array_plus.split_at.d.ts +4 -4
- package/esm/array/array_plus.split_at.d.ts.map +1 -1
- package/esm/array/find_first.d.ts.map +1 -1
- package/esm/array/head.d.ts.map +1 -1
- package/esm/array/intersect_of_props.d.ts.map +1 -1
- package/esm/array/is_array.d.ts +2 -2
- package/esm/array/is_array.d.ts.map +1 -1
- package/esm/array/is_not_array.d.ts +2 -2
- package/esm/array/is_not_array.d.ts.map +1 -1
- package/esm/array/last.d.ts.map +1 -1
- package/esm/array/loose_array_type.d.ts.map +1 -1
- package/esm/array/pad_start.d.ts.map +1 -1
- package/esm/array/reverse.d.ts.map +1 -1
- package/esm/array/union_of_props.d.ts.map +1 -1
- package/esm/assertion/assert_type.js +6 -5
- package/esm/assertion/assert_type.js.map +1 -1
- package/esm/bigint/cast.d.ts.map +1 -1
- package/esm/bigint/is_bigint.d.ts +2 -4
- package/esm/bigint/is_bigint.d.ts.map +1 -1
- package/esm/bigint/is_bigint_literal.d.ts +2 -4
- package/esm/bigint/is_bigint_literal.d.ts.map +1 -1
- package/esm/bigint/is_not_bigint.d.ts +2 -4
- package/esm/bigint/is_not_bigint.d.ts.map +1 -1
- package/esm/bigint/is_not_bigint_literal.d.ts +2 -4
- package/esm/bigint/is_not_bigint_literal.d.ts.map +1 -1
- package/esm/boolean/is_boolean.d.ts +2 -8
- package/esm/boolean/is_boolean.d.ts.map +1 -1
- package/esm/boolean/is_false.d.ts.map +1 -1
- package/esm/boolean/is_not_boolean.d.ts +2 -8
- package/esm/boolean/is_not_boolean.d.ts.map +1 -1
- package/esm/boolean/is_not_false.d.ts.map +1 -1
- package/esm/boolean/is_not_true.d.ts.map +1 -1
- package/esm/boolean/is_true.d.ts.map +1 -1
- package/esm/class/isConstructor.js +1 -0
- package/esm/class/isConstructor.js.map +1 -1
- package/esm/equal/equal.d.ts.map +1 -1
- package/esm/equal/identity_equal.d.ts +1 -1
- package/esm/equal/identity_equal.d.ts.map +1 -1
- package/esm/function/extract_function.d.ts.map +1 -1
- package/esm/function/extract_function.js.map +1 -1
- package/esm/function/is_not_strict_function.d.ts +1 -1
- package/esm/function/is_not_strict_function.d.ts.map +1 -1
- package/esm/function/is_strict_function.d.ts.map +1 -1
- package/esm/functional/Maybe.d.ts.map +1 -1
- package/esm/functional/Maybe.js.map +1 -1
- package/esm/functional/compose.d.ts.map +1 -1
- package/esm/functional/compose.js.map +1 -1
- package/esm/functional/context.d.ts.map +1 -1
- package/esm/math/abs.d.ts.map +1 -1
- package/esm/math/math_plus.to_negative.d.ts.map +1 -1
- package/esm/math/max.d.ts.map +1 -1
- package/esm/math/numeric_struct.d.ts.map +1 -1
- package/esm/mix_types/box.d.ts.map +1 -1
- package/esm/mix_types/is_any_or_never.d.ts.map +1 -1
- package/esm/mix_types/merge.d.ts +9 -9
- package/esm/mix_types/merge.d.ts.map +1 -1
- package/esm/mix_types/merge.js +9 -9
- package/esm/mix_types/merge.js.map +1 -1
- package/esm/never/is_never.d.ts.map +1 -1
- package/esm/never/is_not_never.d.ts.map +1 -1
- package/esm/nodejs/isNodeError.d.ts.map +1 -1
- package/esm/nominal/brand.d.ts.map +1 -1
- package/esm/nominal/brand.js +1 -1
- package/esm/nominal/brand.js.map +1 -1
- package/esm/nominal/flavor.d.ts.map +1 -1
- package/esm/nominal/flavor.js +1 -1
- package/esm/nominal/flavor.js.map +1 -1
- package/esm/nominal/nominal_match.d.ts.map +1 -1
- package/esm/nominal/nominal_match.js.map +1 -1
- package/esm/null/is_not_null.d.ts.map +1 -1
- package/esm/null/is_null.d.ts.map +1 -1
- package/esm/number/cast.d.ts.map +1 -1
- package/esm/number/is_not_number.d.ts +2 -4
- package/esm/number/is_not_number.d.ts.map +1 -1
- package/esm/number/is_not_number_literal.d.ts +2 -4
- package/esm/number/is_not_number_literal.d.ts.map +1 -1
- package/esm/number/is_number.d.ts +2 -4
- package/esm/number/is_number.d.ts.map +1 -1
- package/esm/number/is_number_literal.d.ts +2 -4
- package/esm/number/is_number_literal.d.ts.map +1 -1
- package/esm/numeric/is_integer.d.ts +2 -2
- package/esm/numeric/is_integer.d.ts.map +1 -1
- package/esm/numeric/is_negative.d.ts +5 -5
- package/esm/numeric/is_negative.d.ts.map +1 -1
- package/esm/numeric/is_not_integer.d.ts +2 -2
- package/esm/numeric/is_not_integer.d.ts.map +1 -1
- package/esm/numeric/is_not_negative.d.ts +3 -3
- package/esm/numeric/is_not_negative.d.ts.map +1 -1
- package/esm/numeric/is_not_positive.d.ts +3 -3
- package/esm/numeric/is_not_positive.d.ts.map +1 -1
- package/esm/numeric/is_positive.d.ts +3 -3
- package/esm/numeric/is_positive.d.ts.map +1 -1
- package/esm/numeric/numeric_type.d.ts.map +1 -1
- package/esm/object/ANotB.d.ts.map +1 -1
- package/esm/object/IsDisjoint.d.ts.map +1 -1
- package/esm/object/KeysWithDiffType.d.ts.map +1 -1
- package/esm/object/KnownKeys.d.ts.map +1 -1
- package/esm/object/RecursiveIntersect.d.ts +1 -1
- package/esm/object/RecursiveIntersect.d.ts.map +1 -1
- package/esm/object/RecursiveRequired.d.ts.map +1 -1
- package/esm/object/SpreadRecord.d.ts.map +1 -1
- package/esm/object/facade.d.ts.map +1 -1
- package/esm/object/facade.js.map +1 -1
- package/esm/object/getField.d.ts.map +1 -1
- package/esm/object/getField.js.map +1 -1
- package/esm/object/hasKey.js +1 -1
- package/esm/object/hasKey.js.map +1 -1
- package/esm/object/is_not_object.d.ts +1 -3
- package/esm/object/is_not_object.d.ts.map +1 -1
- package/esm/object/is_object.d.ts.map +1 -1
- package/esm/object/left_join.d.ts.map +1 -1
- package/esm/object/merge.d.ts +6 -5
- package/esm/object/merge.d.ts.map +1 -1
- package/esm/object/omit.d.ts +7 -0
- package/esm/object/omit.d.ts.map +1 -1
- package/esm/object/omit.js.map +1 -1
- package/esm/object/optional_key.d.ts.map +1 -1
- package/esm/object/pick.d.ts.map +1 -1
- package/esm/object/pick.js.map +1 -1
- package/esm/object/recursive_partial.d.ts.map +1 -1
- package/esm/object/split.d.ts +1 -7
- package/esm/object/split.d.ts.map +1 -1
- package/esm/object/split.js +1 -1
- package/esm/object/split.js.map +1 -1
- package/esm/object/typeOverrideIncompatible.js.map +1 -1
- package/esm/predicates/CanAssign.d.ts.map +1 -1
- package/esm/predicates/CanAssign.js.map +1 -1
- package/esm/predicates/assignable.d.ts.map +1 -1
- package/esm/predicates/literal.d.ts.map +1 -1
- package/esm/predicates/logical.d.ts.map +1 -1
- package/esm/predicates/not_assignable.d.ts.map +1 -1
- package/esm/primitive.d.ts.map +1 -1
- package/esm/promise/index.d.ts.map +1 -1
- package/esm/promise/mapSeries.js +1 -1
- package/esm/promise/mapSeries.js.map +1 -1
- package/esm/string/$extract_manipulated_string.d.ts +5 -5
- package/esm/string/$extract_manipulated_string.d.ts.map +1 -1
- package/esm/string/_string_type.d.ts.map +1 -1
- package/esm/string/is_not_string.d.ts +2 -4
- package/esm/string/is_not_string.d.ts.map +1 -1
- package/esm/string/is_not_string_literal.d.ts +4 -8
- package/esm/string/is_not_string_literal.d.ts.map +1 -1
- package/esm/string/is_not_template_literal.d.ts.map +1 -1
- package/esm/string/is_string.d.ts +2 -4
- package/esm/string/is_string.d.ts.map +1 -1
- package/esm/string/is_string_literal.d.ts +4 -8
- package/esm/string/is_string_literal.d.ts.map +1 -1
- package/esm/string/is_template_literal.d.ts.map +1 -1
- package/esm/string/string.d.ts.map +1 -1
- package/esm/string/string_plus.d.ts.map +1 -1
- package/esm/symbol/is_not_symbol.d.ts.map +1 -1
- package/esm/symbol/is_symbol.d.ts.map +1 -1
- package/esm/testing/test_type.d.ts.map +1 -1
- package/esm/tuple/common_prop_keys.d.ts.map +1 -1
- package/esm/tuple/create_tuple.d.ts.map +1 -1
- package/esm/tuple/drop.d.ts.map +1 -1
- package/esm/tuple/drop.js +1 -1
- package/esm/tuple/drop.js.map +1 -1
- package/esm/tuple/is_not_tuple.d.ts +2 -2
- package/esm/tuple/is_not_tuple.d.ts.map +1 -1
- package/esm/tuple/is_tuple.d.ts +2 -2
- package/esm/tuple/is_tuple.d.ts.map +1 -1
- package/esm/tuple/tail.d.ts +1 -1
- package/esm/tuple/tail.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.common_prop_keys.d.ts +1 -1
- package/esm/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.drop_match.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.filter.d.ts +1 -1
- package/esm/tuple/tuple_plus.filter.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.find.d.ts +2 -2
- package/esm/tuple/tuple_plus.find.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.pad_start.d.ts +1 -4
- package/esm/tuple/tuple_plus.pad_start.d.ts.map +1 -1
- package/esm/type_plus/$equality.d.ts.map +1 -1
- package/esm/type_plus/$infer_error.d.ts.map +1 -1
- package/esm/type_plus/$merge_options.d.ts.map +1 -1
- package/esm/type_plus/$resolve_options.d.ts +1 -1
- package/esm/type_plus/$resolve_options.d.ts.map +1 -1
- package/esm/type_plus/$special_type.d.ts +1 -7
- package/esm/type_plus/$special_type.d.ts.map +1 -1
- package/esm/type_plus/$type.d.ts.map +1 -1
- package/esm/type_plus/branch/$branch.d.ts.map +1 -1
- package/esm/type_plus/branch/$exact.d.ts +4 -1
- package/esm/type_plus/branch/$exact.d.ts.map +1 -1
- package/esm/type_plus/branch/$input_options.d.ts.map +1 -1
- package/esm/type_plus/branch/$is_distributive.d.ts.map +1 -1
- package/esm/type_plus/branch/$resolve_branch.d.ts +8 -9
- package/esm/type_plus/branch/$resolve_branch.d.ts.map +1 -1
- package/esm/type_plus/branch/$select.d.ts +1 -3
- package/esm/type_plus/branch/$select.d.ts.map +1 -1
- package/esm/type_plus/branch/$select_invert.d.ts +1 -3
- package/esm/type_plus/branch/$select_invert.d.ts.map +1 -1
- package/esm/type_plus/branch/$select_invert_strict.d.ts +1 -4
- package/esm/type_plus/branch/$select_invert_strict.d.ts.map +1 -1
- package/esm/type_plus/branch/$select_strict.d.ts +1 -4
- package/esm/type_plus/branch/$select_strict.d.ts.map +1 -1
- package/esm/type_plus/branch/$selection.d.ts.map +1 -1
- package/esm/type_plus/branch/$selection_options.d.ts.map +1 -1
- package/esm/undefined/has_undefined.d.ts +3 -1
- package/esm/undefined/has_undefined.d.ts.map +1 -1
- package/esm/undefined/is_not_undefined.d.ts.map +1 -1
- package/esm/undefined/is_undefined.d.ts.map +1 -1
- package/esm/union/union.d.ts.map +1 -1
- package/esm/union/union_to_intersection.d.ts.map +1 -1
- package/esm/union/union_to_intersection.js.map +1 -1
- package/esm/unknown/is_not_unknown.d.ts.map +1 -1
- package/esm/unknown/is_unknown.d.ts.map +1 -1
- package/esm/unknown/not_unknown_or.d.ts.map +1 -1
- package/esm/unknown/unknown.d.ts.map +1 -1
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/void/is_not_void.d.ts.map +1 -1
- package/esm/void/is_void.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/any/is_any.ts +8 -8
- package/src/any/is_not_any.ts +8 -8
- package/src/array/array.at.ts +22 -19
- package/src/array/array.entries.ts +3 -3
- package/src/array/array.find_last.ts +6 -6
- package/src/array/array.reverse.ts +3 -2
- package/src/array/array.some.ts +4 -4
- package/src/array/array_plus.common_prop_keys.ts +5 -6
- package/src/array/array_plus.drop_match.ts +7 -7
- package/src/array/array_plus.element_match.ts +25 -22
- package/src/array/array_plus.filter.ts +11 -12
- package/src/array/array_plus.find.ts +9 -11
- package/src/array/array_plus.index_at.ts +29 -35
- package/src/array/array_plus.is_index_out_of_bound.ts +1 -1
- package/src/array/array_plus.is_readonly.ts +17 -21
- package/src/array/array_plus.pad_start.ts +3 -7
- package/src/array/array_plus.split_at.ts +17 -19
- package/src/array/find_first.ts +6 -5
- package/src/array/head.ts +9 -8
- package/src/array/intersect_of_props.ts +5 -5
- package/src/array/is_array.ts +31 -32
- package/src/array/is_not_array.ts +32 -32
- package/src/array/last.ts +14 -9
- package/src/array/loose_array_type.ts +2 -2
- package/src/array/pad_start.ts +1 -3
- package/src/array/reverse.ts +8 -8
- package/src/array/union_of_props.ts +2 -2
- package/src/assertion/assert_type.ts +5 -3
- package/src/bigint/cast.ts +2 -2
- package/src/bigint/is_bigint.ts +17 -20
- package/src/bigint/is_bigint_literal.ts +12 -14
- package/src/bigint/is_not_bigint.ts +14 -16
- package/src/bigint/is_not_bigint_literal.ts +17 -16
- package/src/boolean/is_boolean.ts +48 -36
- package/src/boolean/is_false.ts +5 -3
- package/src/boolean/is_not_boolean.ts +23 -25
- package/src/boolean/is_not_false.ts +5 -3
- package/src/boolean/is_not_true.ts +5 -3
- package/src/boolean/is_true.ts +5 -3
- package/src/class/isConstructor.ts +1 -1
- package/src/equal/equal.ts +22 -27
- package/src/equal/identity_equal.ts +5 -3
- package/src/function/extract_function.ts +1 -3
- package/src/function/is_not_strict_function.ts +12 -12
- package/src/function/is_strict_function.ts +12 -14
- package/src/functional/Maybe.ts +1 -3
- package/src/functional/compose.ts +2 -4
- package/src/functional/context.ts +1 -1
- package/src/index.ts +0 -1
- package/src/math/abs.ts +18 -8
- package/src/math/math_plus.to_negative.ts +6 -6
- package/src/math/max.ts +2 -2
- package/src/math/numeric_struct.ts +225 -231
- package/src/mix_types/box.ts +34 -37
- package/src/mix_types/is_any_or_never.ts +6 -6
- package/src/mix_types/merge.ts +24 -28
- package/src/never/is_never.ts +13 -10
- package/src/never/is_not_never.ts +13 -10
- package/src/nodejs/isNodeError.ts +13 -13
- package/src/nominal/brand.ts +3 -4
- package/src/nominal/flavor.ts +3 -4
- package/src/nominal/nominal_match.ts +3 -10
- package/src/null/is_not_null.ts +5 -4
- package/src/null/is_null.ts +9 -8
- package/src/number/cast.ts +6 -6
- package/src/number/is_not_number.ts +15 -17
- package/src/number/is_not_number_literal.ts +17 -16
- package/src/number/is_number.ts +15 -17
- package/src/number/is_number_literal.ts +12 -14
- package/src/numeric/is_integer.ts +33 -27
- package/src/numeric/is_negative.ts +23 -23
- package/src/numeric/is_not_integer.ts +31 -26
- package/src/numeric/is_not_negative.ts +19 -19
- package/src/numeric/is_not_positive.ts +19 -19
- package/src/numeric/is_positive.ts +21 -21
- package/src/numeric/numeric_plus.ts +0 -1
- package/src/numeric/numeric_type.ts +0 -1
- package/src/object/ANotB.ts +2 -2
- package/src/object/IsDisjoint.ts +1 -4
- package/src/object/KeysWithDiffType.ts +2 -2
- package/src/object/KnownKeys.ts +7 -7
- package/src/object/RecursiveIntersect.ts +8 -8
- package/src/object/RecursiveRequired.ts +2 -2
- package/src/object/SpreadRecord.ts +1 -4
- package/src/object/facade.ts +1 -9
- package/src/object/getField.ts +1 -4
- package/src/object/hasKey.ts +1 -1
- package/src/object/is_not_object.ts +23 -16
- package/src/object/is_object.ts +23 -15
- package/src/object/left_join.ts +2 -2
- package/src/object/merge.ts +53 -72
- package/src/object/omit.ts +16 -25
- package/src/object/optional_key.ts +1 -4
- package/src/object/pick.ts +8 -19
- package/src/object/recursive_partial.ts +6 -6
- package/src/object/split.ts +3 -14
- package/src/object/typeOverrideIncompatible.ts +3 -3
- package/src/predicates/CanAssign.ts +9 -5
- package/src/predicates/assignable.ts +23 -24
- package/src/predicates/literal.ts +8 -8
- package/src/predicates/logical.ts +4 -4
- package/src/predicates/not_assignable.ts +23 -22
- package/src/primitive.ts +1 -10
- package/src/promise/index.ts +1 -1
- package/src/promise/mapSeries.ts +1 -1
- package/src/string/$extract_manipulated_string.ts +25 -20
- package/src/string/_string_type.ts +6 -6
- package/src/string/is_not_string.ts +13 -15
- package/src/string/is_not_string_literal.ts +29 -34
- package/src/string/is_not_template_literal.ts +18 -21
- package/src/string/is_string.ts +17 -20
- package/src/string/is_string_literal.ts +29 -34
- package/src/string/is_template_literal.ts +18 -20
- package/src/string/string.ts +2 -2
- package/src/string/string_plus.ts +6 -7
- package/src/symbol/is_not_symbol.ts +5 -3
- package/src/symbol/is_symbol.ts +5 -3
- package/src/testing/test_type.ts +89 -89
- package/src/tuple/common_prop_keys.ts +2 -5
- package/src/tuple/create_tuple.ts +18 -18
- package/src/tuple/drop.ts +20 -22
- package/src/tuple/is_not_tuple.ts +19 -21
- package/src/tuple/is_tuple.ts +23 -26
- package/src/tuple/tail.ts +5 -3
- package/src/tuple/tuple_plus.common_prop_keys.ts +6 -12
- package/src/tuple/tuple_plus.drop_match.ts +11 -11
- package/src/tuple/tuple_plus.filter.ts +5 -12
- package/src/tuple/tuple_plus.find.ts +14 -24
- package/src/tuple/tuple_plus.pad_start.ts +12 -27
- package/src/type_plus/$equality.ts +1 -3
- package/src/type_plus/$infer_error.ts +3 -1
- package/src/type_plus/$merge_options.ts +3 -4
- package/src/type_plus/$resolve_options.ts +6 -5
- package/src/type_plus/$special_type.ts +7 -5
- package/src/type_plus/$type.ts +3 -3
- package/src/type_plus/branch/$branch.ts +1 -2
- package/src/type_plus/branch/$exact.ts +9 -5
- package/src/type_plus/branch/$input_options.ts +1 -2
- package/src/type_plus/branch/$is_distributive.ts +7 -4
- package/src/type_plus/branch/$resolve_branch.ts +29 -39
- package/src/type_plus/branch/$select.ts +15 -16
- package/src/type_plus/branch/$select_invert.ts +11 -16
- package/src/type_plus/branch/$select_invert_strict.ts +14 -19
- package/src/type_plus/branch/$select_strict.ts +11 -13
- package/src/type_plus/branch/$selection.ts +8 -9
- package/src/type_plus/branch/$selection_options.ts +3 -3
- package/src/undefined/has_undefined.ts +4 -3
- package/src/undefined/is_not_undefined.ts +9 -9
- package/src/undefined/is_undefined.ts +9 -8
- package/src/union/union.ts +1 -4
- package/src/union/union_to_intersection.ts +1 -3
- package/src/unknown/is_not_unknown.ts +8 -8
- package/src/unknown/is_unknown.ts +8 -8
- package/src/unknown/not_unknown_or.ts +7 -3
- package/src/unknown/unknown.ts +0 -1
- package/src/utils/index.ts +17 -17
- package/src/void/is_not_void.ts +14 -14
- package/src/void/is_void.ts +14 -14
package/src/object/merge.ts
CHANGED
|
@@ -25,83 +25,64 @@ export type Merge<
|
|
|
25
25
|
A extends AnyRecord,
|
|
26
26
|
B extends AnyRecord,
|
|
27
27
|
// biome-ignore lint/correctness/noUnusedVariables: FIXME
|
|
28
|
-
Options = Merge.DefaultOptions
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
Options = Merge.DefaultOptions
|
|
29
|
+
> = Or<
|
|
30
|
+
IsAny<A>,
|
|
31
|
+
IsAny<B>,
|
|
32
|
+
any,
|
|
33
|
+
Or<
|
|
34
|
+
IsNever<A>,
|
|
35
|
+
IsNever<B>,
|
|
36
|
+
never,
|
|
37
|
+
IsDisjoint<A, B> extends true
|
|
37
38
|
? A & B
|
|
38
|
-
:
|
|
39
|
-
?
|
|
40
|
-
?
|
|
41
|
-
?
|
|
42
|
-
?
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(IsNotNever<
|
|
70
|
-
Exclude<KB, KA & KB>,
|
|
71
|
-
{ selection: 'filter' }
|
|
72
|
-
> extends infer R extends KeyTypes ? { [k in R]: B[k] } : unknown) &
|
|
73
|
-
(IsNotNever<
|
|
74
|
-
KA & KB,
|
|
75
|
-
{ selection: 'filter' }
|
|
76
|
-
> extends infer R extends KeyTypes ? { [k in R]: A[k] | B[k] } : unknown)
|
|
77
|
-
)
|
|
78
|
-
: (
|
|
79
|
-
IsLiteral<KB> extends true
|
|
39
|
+
: [keyof A, keyof B] extends [infer KA extends KeyTypes, infer KB extends KeyTypes]
|
|
40
|
+
? IsLiteral<KA> extends true
|
|
41
|
+
? IsLiteral<KB> extends true
|
|
42
|
+
? [OptionalKeys<A>, OptionalKeys<B>] extends [infer PKA extends KeyTypes, infer PKB extends KeyTypes]
|
|
43
|
+
? // property is optional when both A[k] and B[k] are optional
|
|
44
|
+
(IsNotNever<PKA & PKB, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
45
|
+
? { [k in R]?: A[k] | B[k] }
|
|
46
|
+
: unknown) &
|
|
47
|
+
// properties only in A excluding partials is A[k]
|
|
48
|
+
(IsNotNever<Exclude<KA, PKA | KB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
49
|
+
? { [k in R]: A[k] }
|
|
50
|
+
: unknown) &
|
|
51
|
+
// properties only in B excluding partials is B[k]
|
|
52
|
+
(IsNotNever<Exclude<KB, PKB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
53
|
+
? { [k in R]: B[k] }
|
|
54
|
+
: unknown) &
|
|
55
|
+
// properties is required in A but optional in B is unionized without undefined
|
|
56
|
+
(IsNotNever<Exclude<KA & PKB, PKA>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
57
|
+
? { [k in R]: A[k] | Exclude<B[k], undefined> }
|
|
58
|
+
: unknown)
|
|
59
|
+
: never
|
|
60
|
+
: (IsNotNever<Exclude<KA, KA & KB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
61
|
+
? { [k in R]: A[k] }
|
|
62
|
+
: unknown) &
|
|
63
|
+
(IsNotNever<Exclude<KB, KA & KB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
64
|
+
? { [k in R]: B[k] }
|
|
65
|
+
: unknown) &
|
|
66
|
+
(IsNotNever<KA & KB, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
67
|
+
? { [k in R]: A[k] | B[k] }
|
|
68
|
+
: unknown)
|
|
69
|
+
: IsLiteral<KB> extends true
|
|
80
70
|
? { [k in Exclude<KA, KB>]: A[k] } & { [k in keyof B]: B[k] }
|
|
81
|
-
:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
KA & KB,
|
|
92
|
-
{ selection: 'filter' }
|
|
93
|
-
> extends infer R extends KeyTypes ? { [k in R]: A[k] | B[k] } : unknown)
|
|
94
|
-
))
|
|
95
|
-
: never)
|
|
96
|
-
>
|
|
71
|
+
: (IsNotNever<Exclude<KA, KA & KB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
72
|
+
? { [k in R]: A[k] }
|
|
73
|
+
: unknown) &
|
|
74
|
+
(IsNotNever<Exclude<KB, KA & KB>, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
75
|
+
? { [k in R]: B[k] }
|
|
76
|
+
: unknown) &
|
|
77
|
+
(IsNotNever<KA & KB, { selection: 'filter' }> extends infer R extends KeyTypes
|
|
78
|
+
? { [k in R]: A[k] | B[k] }
|
|
79
|
+
: unknown)
|
|
80
|
+
: never
|
|
97
81
|
>
|
|
82
|
+
>
|
|
98
83
|
|
|
99
84
|
export namespace Merge {
|
|
100
|
-
export type JoinProps<A, B> = A extends NonComposableTypes
|
|
101
|
-
? B
|
|
102
|
-
: (B extends NonComposableTypes
|
|
103
|
-
? A
|
|
104
|
-
: A & B)
|
|
85
|
+
export type JoinProps<A, B> = A extends NonComposableTypes ? B : B extends NonComposableTypes ? A : A & B
|
|
105
86
|
|
|
106
87
|
export type Options = {
|
|
107
88
|
$never?: undefined
|
package/src/object/omit.ts
CHANGED
|
@@ -4,12 +4,14 @@ import type { Pick } from './pick.js'
|
|
|
4
4
|
import { record } from './record.js'
|
|
5
5
|
import { reduceByKey } from './reduceKey.js'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Omit properties from a type.
|
|
9
|
+
*
|
|
10
|
+
* @origin [typescript#28339](https://github.com/microsoft/TypeScript/issues/28339#issuecomment-463577347)
|
|
11
|
+
* @originAuthor Titian Cernicova-Dragomir
|
|
12
|
+
* @alternative [type-zoo](https://github.com/pelotom/type-zoo)
|
|
13
|
+
*/
|
|
14
|
+
export type Omit<T, K extends UnionKeys<T>> = T extends unknown ? Pick<T, Exclude<keyof T, K>> : never
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @deprecated replaced by `Omit`
|
|
@@ -22,12 +24,12 @@ export function omit<T extends AnyRecord, P1 extends UnionKeys<T>, P2 extends Un
|
|
|
22
24
|
prop1: P1,
|
|
23
25
|
prop2: P2
|
|
24
26
|
): Omit<T, P1 | P2>
|
|
25
|
-
export function omit<
|
|
26
|
-
T
|
|
27
|
-
P1
|
|
28
|
-
P2
|
|
29
|
-
P3
|
|
30
|
-
|
|
27
|
+
export function omit<T extends AnyRecord, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>>(
|
|
28
|
+
subject: T,
|
|
29
|
+
prop1: P1,
|
|
30
|
+
prop2: P2,
|
|
31
|
+
prop3: P3
|
|
32
|
+
): Omit<T, P1 | P2 | P3>
|
|
31
33
|
export function omit<
|
|
32
34
|
T extends AnyRecord,
|
|
33
35
|
P1 extends UnionKeys<T>,
|
|
@@ -51,15 +53,7 @@ export function omit<
|
|
|
51
53
|
P4 extends UnionKeys<T>,
|
|
52
54
|
P5 extends UnionKeys<T>,
|
|
53
55
|
P6 extends UnionKeys<T>
|
|
54
|
-
>(
|
|
55
|
-
subject: T,
|
|
56
|
-
prop1: P1,
|
|
57
|
-
prop2: P2,
|
|
58
|
-
prop3: P3,
|
|
59
|
-
prop4: P4,
|
|
60
|
-
prop5: P5,
|
|
61
|
-
prop6: P6
|
|
62
|
-
): Omit<T, P1 | P2 | P3 | P4 | P5 | P6>
|
|
56
|
+
>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Omit<T, P1 | P2 | P3 | P4 | P5 | P6>
|
|
63
57
|
export function omit<
|
|
64
58
|
T extends AnyRecord,
|
|
65
59
|
P1 extends UnionKeys<T>,
|
|
@@ -204,10 +198,7 @@ export function omit<
|
|
|
204
198
|
prop11: P11,
|
|
205
199
|
prop12: P12
|
|
206
200
|
): Omit<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>
|
|
207
|
-
export function omit<T extends AnyRecord, Props extends UnionKeys<T>>(
|
|
208
|
-
subject: T,
|
|
209
|
-
...props: Props[]
|
|
210
|
-
): Omit<T, Props>
|
|
201
|
+
export function omit<T extends AnyRecord, Props extends UnionKeys<T>>(subject: T, ...props: Props[]): Omit<T, Props>
|
|
211
202
|
export function omit<T extends AnyRecord>(subject: T, ...props: Array<UnionKeys<T>>) {
|
|
212
203
|
return reduceByKey(
|
|
213
204
|
subject,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import type { AnyRecord } from './any_record.js'
|
|
3
2
|
import type { KeyTypes } from './KeyTypes.js'
|
|
4
3
|
|
|
@@ -33,6 +32,4 @@ export type OptionalKeys<T> = T extends unknown
|
|
|
33
32
|
/**
|
|
34
33
|
* Parse `T` to keep only the optional properties.
|
|
35
34
|
*/
|
|
36
|
-
export type OptionalProps<T extends AnyRecord> = T extends unknown
|
|
37
|
-
? { [k in OptionalKeys<T>]?: T[k] }
|
|
38
|
-
: never
|
|
35
|
+
export type OptionalProps<T extends AnyRecord> = T extends unknown ? { [k in OptionalKeys<T>]?: T[k] } : never
|
package/src/object/pick.ts
CHANGED
|
@@ -9,12 +9,12 @@ export function pick<T extends AnyRecord, P1 extends UnionKeys<T>, P2 extends Un
|
|
|
9
9
|
prop1: P1,
|
|
10
10
|
prop2: P2
|
|
11
11
|
): Pick<T, P1 | P2>
|
|
12
|
-
export function pick<
|
|
13
|
-
T
|
|
14
|
-
P1
|
|
15
|
-
P2
|
|
16
|
-
P3
|
|
17
|
-
|
|
12
|
+
export function pick<T extends AnyRecord, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>>(
|
|
13
|
+
subject: T,
|
|
14
|
+
prop1: P1,
|
|
15
|
+
prop2: P2,
|
|
16
|
+
prop3: P3
|
|
17
|
+
): Pick<T, P1 | P2 | P3>
|
|
18
18
|
export function pick<
|
|
19
19
|
T extends AnyRecord,
|
|
20
20
|
P1 extends UnionKeys<T>,
|
|
@@ -38,15 +38,7 @@ export function pick<
|
|
|
38
38
|
P4 extends UnionKeys<T>,
|
|
39
39
|
P5 extends UnionKeys<T>,
|
|
40
40
|
P6 extends UnionKeys<T>
|
|
41
|
-
>(
|
|
42
|
-
subject: T,
|
|
43
|
-
prop1: P1,
|
|
44
|
-
prop2: P2,
|
|
45
|
-
prop3: P3,
|
|
46
|
-
prop4: P4,
|
|
47
|
-
prop5: P5,
|
|
48
|
-
prop6: P6
|
|
49
|
-
): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>
|
|
41
|
+
>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>
|
|
50
42
|
export function pick<
|
|
51
43
|
T extends AnyRecord,
|
|
52
44
|
P1 extends UnionKeys<T>,
|
|
@@ -191,10 +183,7 @@ export function pick<
|
|
|
191
183
|
prop11: P11,
|
|
192
184
|
prop12: P12
|
|
193
185
|
): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>
|
|
194
|
-
export function pick<T extends AnyRecord, Props extends UnionKeys<T>>(
|
|
195
|
-
subject: T,
|
|
196
|
-
...props: Props[]
|
|
197
|
-
): Pick<T, Props>
|
|
186
|
+
export function pick<T extends AnyRecord, Props extends UnionKeys<T>>(subject: T, ...props: Props[]): Pick<T, Props>
|
|
198
187
|
export function pick<T extends AnyRecord>(subject: T, ...props: Array<UnionKeys<T>>) {
|
|
199
188
|
return reduceByKey(
|
|
200
189
|
subject,
|
|
@@ -30,10 +30,10 @@ export type RecursivePartial<T> = {
|
|
|
30
30
|
[P in keyof T]?: T[P] extends (infer U)[]
|
|
31
31
|
? RecursivePartial<U>[] | undefined
|
|
32
32
|
: T[P] extends infer F extends AnyFunction
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
? [keyof T[P]] extends [undefined]
|
|
34
|
+
? T[P] | undefined
|
|
35
|
+
: ExtractFunction<F> & RecursivePartial<Properties<T[P]>>
|
|
36
|
+
: T[P] extends AnyRecord
|
|
37
|
+
? RecursivePartial<T[P]> | undefined
|
|
38
|
+
: T[P] | undefined
|
|
39
39
|
}
|
package/src/object/split.ts
CHANGED
|
@@ -22,12 +22,7 @@ export function split<T extends AnyRecord, S1 extends Splitter<T>, S2 extends Sp
|
|
|
22
22
|
split1: S1,
|
|
23
23
|
split2: S2
|
|
24
24
|
): [Split<T, S1>, Split<T, S2>, Omit<T, keyof S1 | keyof S2>]
|
|
25
|
-
export function split<
|
|
26
|
-
T extends AnyRecord,
|
|
27
|
-
S1 extends Splitter<T>,
|
|
28
|
-
S2 extends Splitter<T>,
|
|
29
|
-
S3 extends Splitter<T>
|
|
30
|
-
>(
|
|
25
|
+
export function split<T extends AnyRecord, S1 extends Splitter<T>, S2 extends Splitter<T>, S3 extends Splitter<T>>(
|
|
31
26
|
target: T,
|
|
32
27
|
splitter1: S1,
|
|
33
28
|
splitter2: S2,
|
|
@@ -45,13 +40,7 @@ export function split<
|
|
|
45
40
|
splitter2: S2,
|
|
46
41
|
splitter3: S3,
|
|
47
42
|
splitter4: S4
|
|
48
|
-
): [
|
|
49
|
-
Split<T, S1>,
|
|
50
|
-
Split<T, S2>,
|
|
51
|
-
Split<T, S3>,
|
|
52
|
-
Split<T, S4>,
|
|
53
|
-
Omit<T, keyof S1 | keyof S2 | keyof S3 | keyof S4>
|
|
54
|
-
]
|
|
43
|
+
): [Split<T, S1>, Split<T, S2>, Split<T, S3>, Split<T, S4>, Omit<T, keyof S1 | keyof S2 | keyof S3 | keyof S4>]
|
|
55
44
|
export function split<
|
|
56
45
|
T extends AnyRecord,
|
|
57
46
|
S1 extends Splitter<T>,
|
|
@@ -194,7 +183,7 @@ export function split<
|
|
|
194
183
|
]
|
|
195
184
|
export function split(target: AnyRecord, ...splitters: AnyRecord[]): AnyRecord[] {
|
|
196
185
|
const keyMap: AnyRecord = {}
|
|
197
|
-
const s = splitters.map(s =>
|
|
186
|
+
const s = splitters.map((s) =>
|
|
198
187
|
reduceByKey(s, (p, k) => ((keyMap[k] = true), (p[k] = target[k] ?? s[k]), p), {} as AnyRecord)
|
|
199
188
|
)
|
|
200
189
|
const r = reduceByKey(target, (p, k) => (keyMap[k] ? p : ((p[k] = target[k]), p)), {} as AnyRecord)
|
|
@@ -28,11 +28,11 @@ import type { NotExtendable } from './Extends.js'
|
|
|
28
28
|
*/
|
|
29
29
|
export type CanAssign<A, B, Then = true, Else = false> = boolean extends A
|
|
30
30
|
? boolean extends B
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
? Then
|
|
32
|
+
: Else
|
|
33
33
|
: A extends B
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
? Then
|
|
35
|
+
: Else
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Can `A` strictly assign to `B`.
|
|
@@ -47,7 +47,11 @@ export type CanAssign<A, B, Then = true, Else = false> = boolean extends A
|
|
|
47
47
|
* StrictCanAssign<number | string, number | string> // true
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
export type StrictCanAssign<A, B, Then = true, Else = false> = Assignable<
|
|
50
|
+
export type StrictCanAssign<A, B, Then = true, Else = false> = Assignable<
|
|
51
|
+
A,
|
|
52
|
+
B,
|
|
53
|
+
{ distributive: false; $then: Then; $else: Else }
|
|
54
|
+
>
|
|
51
55
|
|
|
52
56
|
/**
|
|
53
57
|
* @deprecated use `Assignable<A, B>` instead
|
|
@@ -56,22 +56,23 @@ import type { $Unknown } from '../unknown/unknown.js'
|
|
|
56
56
|
* type R = Assignable<never, any, { $never: 1 }> // 1
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export type Assignable<
|
|
60
|
-
A,
|
|
59
|
+
export type Assignable<A, B, $O extends Assignable.$Options = {}> = $SpecialType<
|
|
61
60
|
B,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
61
|
+
{
|
|
62
|
+
$any: $ResolveBranch<A, $O, [0 extends 1 & A ? $Any : unknown, $Then]>
|
|
63
|
+
$unknown: $ResolveBranch<A, $O, [[A, unknown] extends [unknown, A] ? $Unknown : unknown, $Then]>
|
|
64
|
+
$never: $ResolveBranch<A, $O, [A, never] extends [never, A] ? [$Never, $Then] : [$Else]>
|
|
65
|
+
$else: $SpecialType<
|
|
66
|
+
A,
|
|
67
|
+
{
|
|
68
|
+
$any: $ResolveBranch<A, $O, [$Any, $Then]>
|
|
69
|
+
$unknown: $ResolveBranch<A, $O, [$Unknown, $Then]>
|
|
70
|
+
$never: $ResolveBranch<A, $O, [$Never, $Then]>
|
|
71
|
+
$else: Assignable.$<A, B, $O>
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
}
|
|
75
|
+
>
|
|
75
76
|
|
|
76
77
|
export namespace Assignable {
|
|
77
78
|
export type $Options = $SelectionOptions & $DistributiveOptions & $InputOptions<$Any | $Unknown | $Never>
|
|
@@ -88,15 +89,13 @@ export namespace Assignable {
|
|
|
88
89
|
*
|
|
89
90
|
* It is suitable for building custom types.
|
|
90
91
|
*/
|
|
91
|
-
export type $<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
$else: [A] extends [B] ? $ResolveBranch<A, $O, [$Then]> : $ResolveBranch<A, $O, [$Else]>,
|
|
99
|
-
}>
|
|
92
|
+
export type $<A, B, $O extends $UtilOptions> = $IsDistributive<
|
|
93
|
+
$O,
|
|
94
|
+
{
|
|
95
|
+
$then: A extends B ? $ResolveBranch<A, $O, [$Then]> : $ResolveBranch<A, $O, [$Else]>
|
|
96
|
+
$else: [A] extends [B] ? $ResolveBranch<A, $O, [$Then]> : $ResolveBranch<A, $O, [$Else]>
|
|
97
|
+
}
|
|
98
|
+
>
|
|
100
99
|
|
|
101
100
|
export type $UtilOptions = $SelectionOptions & $DistributiveOptions
|
|
102
101
|
}
|
|
@@ -25,11 +25,11 @@ export type IsLiteral<
|
|
|
25
25
|
> = number extends T
|
|
26
26
|
? Else
|
|
27
27
|
: string extends T
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
? Else
|
|
29
|
+
: boolean extends T
|
|
30
|
+
? Else
|
|
31
|
+
: symbol extends T
|
|
32
|
+
? Else
|
|
33
|
+
: bigint extends T
|
|
34
|
+
? Else
|
|
35
|
+
: Then
|
|
@@ -7,13 +7,13 @@ export type And<A extends boolean, B extends boolean, Then = true, Else = false>
|
|
|
7
7
|
export type Or<A extends boolean, B extends boolean, Then = true, Else = false> = A extends true
|
|
8
8
|
? Then
|
|
9
9
|
: B extends true
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
? Then
|
|
11
|
+
: Else
|
|
12
12
|
|
|
13
13
|
export type Not<X extends boolean, Then = true, Else = false> = X extends true ? Else : Then
|
|
14
14
|
|
|
15
15
|
export type Xor<A extends boolean, B extends boolean, Then = true, Else = false> = A extends Then
|
|
16
16
|
? Not<B>
|
|
17
17
|
: B extends true
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
? Then
|
|
19
|
+
: Else
|
|
@@ -56,21 +56,23 @@ import type { $Unknown } from '../unknown/unknown.js'
|
|
|
56
56
|
* type R = NotAssignable<never, any, { $never: 1 }> // 1
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export type NotAssignable<
|
|
60
|
-
A,
|
|
59
|
+
export type NotAssignable<A, B, $O extends NotAssignable.$Options = {}> = $SpecialType<
|
|
61
60
|
B,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
61
|
+
{
|
|
62
|
+
$any: $ResolveBranch<A, $O, [0 extends 1 & A ? $Any : unknown, $Else]>
|
|
63
|
+
$unknown: $ResolveBranch<A, $O, [[A, unknown] extends [unknown, A] ? $Unknown : unknown, $Else]>
|
|
64
|
+
$never: $ResolveBranch<A, $O, [A, never] extends [never, A] ? [$Never, $Else] : [$Then]>
|
|
65
|
+
$else: $SpecialType<
|
|
66
|
+
A,
|
|
67
|
+
{
|
|
68
|
+
$any: $ResolveBranch<A, $O, [$Any, $Else]>
|
|
69
|
+
$unknown: $ResolveBranch<A, $O, [$Unknown, $Else]>
|
|
70
|
+
$never: $ResolveBranch<A, $O, [$Never, $Else]>
|
|
71
|
+
$else: NotAssignable.$<A, B, $O>
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
}
|
|
75
|
+
>
|
|
74
76
|
|
|
75
77
|
export namespace NotAssignable {
|
|
76
78
|
export type $Options = $SelectionOptions & $DistributiveOptions & $InputOptions<$Any | $Unknown | $Never>
|
|
@@ -87,14 +89,13 @@ export namespace NotAssignable {
|
|
|
87
89
|
*
|
|
88
90
|
* It is suitable for building custom types.
|
|
89
91
|
*/
|
|
90
|
-
export type $<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}>
|
|
92
|
+
export type $<A, B, $O extends $UtilOptions> = $IsDistributive<
|
|
93
|
+
$O,
|
|
94
|
+
{
|
|
95
|
+
$then: A extends B ? $ResolveBranch<A, $O, [$Else]> : $ResolveBranch<A, $O, [$Then]>
|
|
96
|
+
$else: [A] extends [B] ? $ResolveBranch<A, $O, [$Else]> : $ResolveBranch<A, $O, [$Then]>
|
|
97
|
+
}
|
|
98
|
+
>
|
|
98
99
|
|
|
99
100
|
export type $UtilOptions = $SelectionOptions & $DistributiveOptions
|
|
100
101
|
}
|
package/src/primitive.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 📘 Definition of all primitive types.
|
|
3
3
|
*/
|
|
4
|
-
export type PrimitiveTypes =
|
|
5
|
-
| boolean
|
|
6
|
-
| number
|
|
7
|
-
| string
|
|
8
|
-
| object
|
|
9
|
-
| symbol
|
|
10
|
-
| bigint
|
|
11
|
-
| Function
|
|
12
|
-
| undefined
|
|
13
|
-
| null
|
|
4
|
+
export type PrimitiveTypes = boolean | number | string | object | symbol | bigint | Function | undefined | null
|
package/src/promise/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './isPromise.js'
|
|
2
2
|
export * from './mapSeries.js'
|
|
3
3
|
export * from './MaybePromise.js'
|
|
4
|
-
export type { AwaitedProp,PromiseValue } from './PromiseValue.js'
|
|
4
|
+
export type { AwaitedProp, PromiseValue } from './PromiseValue.js'
|
|
5
5
|
export type { PromiseValueMerge } from './PromiseValueMerge.js'
|
package/src/promise/mapSeries.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export function mapSeries<R, T = any>(values: T[], fn: (value: T) => Promise<R>): Promise<R[]> {
|
|
2
|
-
return values.reduce((p, v) => p.then(r => fn(v).then(v => (r.push(v), r))), Promise.resolve<R[]>([]))
|
|
2
|
+
return values.reduce((p, v) => p.then((r) => fn(v).then((v) => (r.push(v), r))), Promise.resolve<R[]>([]))
|
|
3
3
|
}
|
|
@@ -8,38 +8,43 @@
|
|
|
8
8
|
* - `Capitalize`
|
|
9
9
|
* - `Uncapitalize`
|
|
10
10
|
*/
|
|
11
|
-
export type $ExtractManipulatedString<T extends string> =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$ExtractManipulatedString._LowerOrElse<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export type $ExtractManipulatedString<T extends string> = [T, unknown] extends [unknown, T]
|
|
12
|
+
? T
|
|
13
|
+
: $ExtractManipulatedString._UpperOrElse<
|
|
14
|
+
T,
|
|
15
|
+
$ExtractManipulatedString._LowerOrElse<
|
|
16
|
+
T,
|
|
17
|
+
$ExtractManipulatedString._CapOrElse<T, $ExtractManipulatedString._UncapOrElse<T, T>>
|
|
18
|
+
>
|
|
19
|
+
>
|
|
19
20
|
|
|
20
21
|
export namespace $ExtractManipulatedString {
|
|
21
22
|
export type _UpperOrElse<N, Else> = N extends Uppercase<infer Y>
|
|
22
|
-
?
|
|
23
|
-
? Uppercase<any> extends N
|
|
23
|
+
? string extends Y
|
|
24
|
+
? Uppercase<any> extends N
|
|
25
|
+
? Y
|
|
26
|
+
: N
|
|
24
27
|
: $ExtractManipulatedString<Y>
|
|
25
|
-
)
|
|
26
28
|
: Else
|
|
27
29
|
export type _LowerOrElse<N, Else> = N extends Lowercase<infer Y>
|
|
28
|
-
?
|
|
29
|
-
? Lowercase<any> extends N
|
|
30
|
+
? string extends Y
|
|
31
|
+
? Lowercase<any> extends N
|
|
32
|
+
? Y
|
|
33
|
+
: N
|
|
30
34
|
: $ExtractManipulatedString<Y>
|
|
31
|
-
)
|
|
32
35
|
: Else
|
|
33
36
|
export type _CapOrElse<N, Else> = N extends Capitalize<infer Y>
|
|
34
|
-
?
|
|
35
|
-
? Capitalize<any> extends N
|
|
37
|
+
? string extends Y
|
|
38
|
+
? Capitalize<any> extends N
|
|
39
|
+
? Y
|
|
40
|
+
: N
|
|
36
41
|
: $ExtractManipulatedString<Y>
|
|
37
|
-
)
|
|
38
42
|
: Else
|
|
39
43
|
export type _UncapOrElse<N, Else> = N extends Uncapitalize<infer Y>
|
|
40
|
-
?
|
|
41
|
-
? Uncapitalize<any> extends N
|
|
44
|
+
? string extends Y
|
|
45
|
+
? Uncapitalize<any> extends N
|
|
46
|
+
? Y
|
|
47
|
+
: N
|
|
42
48
|
: $ExtractManipulatedString<Y>
|
|
43
|
-
)
|
|
44
49
|
: Else
|
|
45
50
|
}
|
|
@@ -2,10 +2,10 @@ import type { $ExtractManipulatedString } from './$extract_manipulated_string.js
|
|
|
2
2
|
|
|
3
3
|
export type _StringType<T extends string> = $ExtractManipulatedString<T> extends infer K
|
|
4
4
|
? K extends string & infer U
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
? [K, U] extends [U, K]
|
|
6
|
+
? {} extends { [P in `${K}`]: unknown }
|
|
7
|
+
? 'templateLiteral'
|
|
8
|
+
: 'stringLiteral'
|
|
9
|
+
: 'string'
|
|
10
|
+
: never
|
|
11
11
|
: never
|