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/testing/test_type.ts
CHANGED
|
@@ -26,13 +26,13 @@ export namespace testType {
|
|
|
26
26
|
*
|
|
27
27
|
* @return `expected` as `A` for type inspection.
|
|
28
28
|
*/
|
|
29
|
-
equal<A, B, C>(expected: IsEqual<A, B> & IsEqual<A, C>): A
|
|
29
|
+
equal<A, B, C>(expected: IsEqual<A, B> & IsEqual<A, C>): A
|
|
30
30
|
/**
|
|
31
31
|
* Check if type `A` is equal to type `B`.
|
|
32
32
|
*
|
|
33
33
|
* @return `expected` as `A` for type inspection.
|
|
34
34
|
*/
|
|
35
|
-
equal<A, B>(expected: IsEqual<A, B>): A
|
|
35
|
+
equal<A, B>(expected: IsEqual<A, B>): A
|
|
36
36
|
/**
|
|
37
37
|
* Check if `A` can assign to `B`.
|
|
38
38
|
*
|
|
@@ -54,7 +54,7 @@ export namespace testType {
|
|
|
54
54
|
*
|
|
55
55
|
* @return `expected` as `A` for type inspection.
|
|
56
56
|
*/
|
|
57
|
-
canAssign<A, B>(expected: Assignable<A, B>): A
|
|
57
|
+
canAssign<A, B>(expected: Assignable<A, B>): A
|
|
58
58
|
/**
|
|
59
59
|
* Check if `A` can fully assign to `B`.
|
|
60
60
|
*
|
|
@@ -69,91 +69,91 @@ export namespace testType {
|
|
|
69
69
|
*
|
|
70
70
|
* @return `expected` as `A` for type inspection.
|
|
71
71
|
*/
|
|
72
|
-
strictCanAssign<A, B>(expected: Assignable<A, B, { distributive: false }>): A
|
|
72
|
+
strictCanAssign<A, B>(expected: Assignable<A, B, { distributive: false }>): A
|
|
73
73
|
/**
|
|
74
74
|
* Check if type `T` is exactly `any`.
|
|
75
75
|
*
|
|
76
76
|
* @return `expected` as `T` for type inspection.
|
|
77
77
|
*/
|
|
78
|
-
any<T>(expected: IsAny<T>): T
|
|
78
|
+
any<T>(expected: IsAny<T>): T
|
|
79
79
|
/**
|
|
80
80
|
* Check if type `T` is exactly `array`.
|
|
81
81
|
*
|
|
82
82
|
* @return `expected` as `T` for type inspection.
|
|
83
83
|
*/
|
|
84
|
-
array<T>(expected: IsArray<T, { exact: true }>): T
|
|
84
|
+
array<T>(expected: IsArray<T, { exact: true }>): T
|
|
85
85
|
/**
|
|
86
86
|
* Check if type `T` is exactly `bigint`.
|
|
87
87
|
*
|
|
88
88
|
* @return `expected` as `T` for type inspection.
|
|
89
89
|
*/
|
|
90
|
-
strictBigint<T>(expected: IsBigint<T, { distributive: false
|
|
90
|
+
strictBigint<T>(expected: IsBigint<T, { distributive: false; exact: true }>): T
|
|
91
91
|
/**
|
|
92
92
|
* Check if type `T` is `bigint` or bigint literals.
|
|
93
93
|
*
|
|
94
94
|
* @return `expected` as `T` for type inspection.
|
|
95
95
|
*/
|
|
96
|
-
bigint<T>(expected: IsBigint<T, { distributive: false }>): T
|
|
96
|
+
bigint<T>(expected: IsBigint<T, { distributive: false }>): T
|
|
97
97
|
/**
|
|
98
98
|
* Check if type `T` is exactly `boolean`.
|
|
99
99
|
*
|
|
100
100
|
* @return `expected` as `T` for type inspection.
|
|
101
101
|
*/
|
|
102
|
-
strictBoolean<T>(expected: IsBoolean<T, { distributive: false
|
|
102
|
+
strictBoolean<T>(expected: IsBoolean<T, { distributive: false; exact: true }>): T
|
|
103
103
|
/**
|
|
104
104
|
* Check if type `T` is `boolean` and boolean literals.
|
|
105
105
|
*
|
|
106
106
|
* @return `expected` as `T` for type inspection.
|
|
107
107
|
*/
|
|
108
|
-
boolean<T>(expected: IsBoolean<T, { distributive: false }>): T
|
|
108
|
+
boolean<T>(expected: IsBoolean<T, { distributive: false }>): T
|
|
109
109
|
/**
|
|
110
110
|
* Check if type `T` is exactly `true`.
|
|
111
111
|
*
|
|
112
112
|
* @return `expected` as `T` for type inspection.
|
|
113
113
|
*/
|
|
114
|
-
true<T>(expected: IsTrue<T, { distributive: false }>): T
|
|
114
|
+
true<T>(expected: IsTrue<T, { distributive: false }>): T
|
|
115
115
|
/**
|
|
116
116
|
* Check if type `T` is exactly `false`.
|
|
117
117
|
*
|
|
118
118
|
* @return `expected` as `T` for type inspection.
|
|
119
119
|
*/
|
|
120
|
-
false<T>(expected: IsFalse<T, { distributive: false }>): T
|
|
120
|
+
false<T>(expected: IsFalse<T, { distributive: false }>): T
|
|
121
121
|
/**
|
|
122
122
|
* Check if type `T` is exactly `boolean`.
|
|
123
123
|
*
|
|
124
124
|
* @return `expected` as `T` for type inspection.
|
|
125
125
|
*/
|
|
126
|
-
strictFunction<T>(expected: IsStrictFunction<T, { distributive: false }>): T
|
|
126
|
+
strictFunction<T>(expected: IsStrictFunction<T, { distributive: false }>): T
|
|
127
127
|
/**
|
|
128
128
|
* Check if type `T` is `boolean` and boolean literals.
|
|
129
129
|
*
|
|
130
130
|
* @return `expected` as `T` for type inspection.
|
|
131
131
|
*/
|
|
132
|
-
function<T>(expected: IsFunction<T, { distributive: false }>): T
|
|
132
|
+
function<T>(expected: IsFunction<T, { distributive: false }>): T
|
|
133
133
|
/**
|
|
134
134
|
* Check if type `T` is exactly `never`.
|
|
135
135
|
*
|
|
136
136
|
* @return `expected` as `T` for type inspection.
|
|
137
137
|
*/
|
|
138
|
-
never<T>(expected: IsNever<T>): T
|
|
138
|
+
never<T>(expected: IsNever<T>): T
|
|
139
139
|
/**
|
|
140
140
|
* Check if type `T` is exactly `null`.
|
|
141
141
|
*
|
|
142
142
|
* @return `expected` as `T` for type inspection.
|
|
143
143
|
*/
|
|
144
|
-
null<T>(expected: IsNull<T, { distributive: false }>): T
|
|
144
|
+
null<T>(expected: IsNull<T, { distributive: false }>): T
|
|
145
145
|
/**
|
|
146
146
|
* Check if type `T` is exactly `number`.
|
|
147
147
|
*
|
|
148
148
|
* @return `expected` as `T` for type inspection.
|
|
149
149
|
*/
|
|
150
|
-
strictNumber<T>(expected: IsNumber<T, { distributive: false
|
|
150
|
+
strictNumber<T>(expected: IsNumber<T, { distributive: false; exact: true }>): T
|
|
151
151
|
/**
|
|
152
152
|
* Check if type `T` is `number` or number literals.
|
|
153
153
|
*
|
|
154
154
|
* @return `expected` as `T` for type inspection.
|
|
155
155
|
*/
|
|
156
|
-
number<T>(expected: IsNumber<T, { distributive: false }>): T
|
|
156
|
+
number<T>(expected: IsNumber<T, { distributive: false }>): T
|
|
157
157
|
/**
|
|
158
158
|
* Check if type `T` is `object`.
|
|
159
159
|
*
|
|
@@ -161,50 +161,50 @@ export namespace testType {
|
|
|
161
161
|
*
|
|
162
162
|
* @return `expected` as `T` for type inspection.
|
|
163
163
|
*/
|
|
164
|
-
object<T>(expected: IsObject<T, { distributive: false }>): T
|
|
164
|
+
object<T>(expected: IsObject<T, { distributive: false }>): T
|
|
165
165
|
/**
|
|
166
166
|
* Check if type `T` is exactly `string`.
|
|
167
167
|
*
|
|
168
168
|
* @return `expected` as `T` for type inspection.
|
|
169
169
|
*/
|
|
170
|
-
strictString<T>(expected: IsString<T, { distributive: false
|
|
170
|
+
strictString<T>(expected: IsString<T, { distributive: false; exact: true }>): T
|
|
171
171
|
/**
|
|
172
172
|
* Check if type `T` is `string` or string literals.
|
|
173
173
|
*
|
|
174
174
|
* @return `expected` as `T` for type inspection.
|
|
175
175
|
*/
|
|
176
|
-
string<T>(expected: IsString<T, { distributive: false }>): T
|
|
176
|
+
string<T>(expected: IsString<T, { distributive: false }>): T
|
|
177
177
|
/**
|
|
178
178
|
* Check if type `T` is a `symbol`.
|
|
179
179
|
*
|
|
180
180
|
* @return `expected` as `T` for type inspection.
|
|
181
181
|
*/
|
|
182
|
-
symbol<T>(expected: IsSymbol<T, { distributive: false }>): T
|
|
182
|
+
symbol<T>(expected: IsSymbol<T, { distributive: false }>): T
|
|
183
183
|
/**
|
|
184
184
|
* Check if type `T` is a *tuple*.
|
|
185
185
|
*
|
|
186
186
|
* @return `expected` as `T` for type inspection.
|
|
187
187
|
*/
|
|
188
|
-
tuple<T>(expected: IsTuple<T, { distributive: false }>): T
|
|
188
|
+
tuple<T>(expected: IsTuple<T, { distributive: false }>): T
|
|
189
189
|
/**
|
|
190
190
|
* Check if type `T` is exactly `undefined`.
|
|
191
191
|
*
|
|
192
192
|
* @return `expected` as `T` for type inspection.
|
|
193
193
|
*/
|
|
194
|
-
undefined<T>(expected: IsUndefined<T, { distributive: false }>): T
|
|
194
|
+
undefined<T>(expected: IsUndefined<T, { distributive: false }>): T
|
|
195
195
|
// hasUndefined<T>(expected: CanAssign<T, undefined>): T
|
|
196
196
|
/**
|
|
197
197
|
* Check if type `T` is exactly `unknown`.
|
|
198
198
|
*
|
|
199
199
|
* @return `expected` as `T` for type inspection.
|
|
200
200
|
*/
|
|
201
|
-
unknown<T>(expected: IsUnknown<T>): T
|
|
201
|
+
unknown<T>(expected: IsUnknown<T>): T
|
|
202
202
|
/**
|
|
203
203
|
* Check if type `T` is exactly `void`.
|
|
204
204
|
*
|
|
205
205
|
* @return `expected` as `T` for type inspection.
|
|
206
206
|
*/
|
|
207
|
-
void<T>(expected: IsVoid<T, { distributive: false }>): T
|
|
207
|
+
void<T>(expected: IsVoid<T, { distributive: false }>): T
|
|
208
208
|
/**
|
|
209
209
|
* A quick way to inspect a type.
|
|
210
210
|
*
|
|
@@ -232,69 +232,69 @@ export namespace testType {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
export type InspectedType<T> = {
|
|
235
|
-
type: T
|
|
236
|
-
extends<R>(): T extends R ? true : false
|
|
237
|
-
extends_any: T extends any ? true : false
|
|
238
|
-
extends_unknown: T extends unknown ? true : false
|
|
239
|
-
extends_void: T extends void ? true : false
|
|
240
|
-
extends_never: T extends never ? true : false
|
|
241
|
-
extends_undefined: T extends undefined ? true : false
|
|
242
|
-
extends_null: T extends null ? true : false
|
|
243
|
-
extends_boolean: T extends boolean ? true : false
|
|
244
|
-
extends_true: T extends true ? true : false
|
|
245
|
-
extends_false: T extends false ? true : false
|
|
246
|
-
extends_number: T extends number ? true : false
|
|
247
|
-
extends_1: T extends 1 ? true : false
|
|
248
|
-
extends_bigint: T extends bigint ? true : false
|
|
249
|
-
extends_1n: T extends 1n ? true : false
|
|
250
|
-
extends_string: T extends string ? true : false
|
|
251
|
-
extends_a: T extends 'a' ? true : false
|
|
252
|
-
extends_symbol: T extends symbol ? true : false
|
|
253
|
-
extends_object: T extends object ? true : false
|
|
254
|
-
extends_function: T extends Function ? true : false
|
|
255
|
-
extends_array_unknown: T extends unknown[] ? true : false
|
|
256
|
-
extends_tuple_empty: T extends [] ? true : false
|
|
257
|
-
union<R>(): T | R
|
|
258
|
-
union_any: T | any
|
|
259
|
-
union_unknown: T | unknown
|
|
260
|
-
union_void: T | void
|
|
261
|
-
union_never: T | never
|
|
262
|
-
union_undefined: T | undefined
|
|
263
|
-
union_null: T | null
|
|
264
|
-
union_boolean: T | boolean
|
|
265
|
-
union_true: T | true
|
|
266
|
-
union_false: T | false
|
|
267
|
-
union_number: T | number
|
|
268
|
-
union_1: T | 1
|
|
269
|
-
union_bigint: T | bigint
|
|
270
|
-
union_1n: T | 1n
|
|
271
|
-
union_string: T | string
|
|
272
|
-
union_a: T | 'a'
|
|
273
|
-
union_symbol: T | symbol
|
|
274
|
-
union_object: T | object
|
|
275
|
-
union_function: T | Function
|
|
276
|
-
union_array_unknown: T | unknown[]
|
|
277
|
-
union_tuple_empty: T | []
|
|
278
|
-
intersect<R>(): T & R
|
|
279
|
-
intersect_any: T & any
|
|
280
|
-
intersect_unknown: T & unknown
|
|
281
|
-
intersect_void: T & void
|
|
282
|
-
intersect_never: T & never
|
|
283
|
-
intersect_undefined: T & undefined
|
|
284
|
-
intersect_null: T & null
|
|
285
|
-
intersect_boolean: T & boolean
|
|
286
|
-
intersect_true: T & true
|
|
287
|
-
intersect_false: T & false
|
|
288
|
-
intersect_number: T & number
|
|
289
|
-
intersect_1: T & 1
|
|
290
|
-
intersect_bigint: T & bigint
|
|
291
|
-
intersect_1n: T & 1n
|
|
292
|
-
intersect_string: T & string
|
|
293
|
-
intersect_a: T & 'a'
|
|
294
|
-
intersect_symbol: T & symbol
|
|
295
|
-
intersect_object: T & object
|
|
296
|
-
intersect_function: T & Function
|
|
297
|
-
intersect_array_unknown: T & unknown[]
|
|
235
|
+
type: T
|
|
236
|
+
extends<R>(): T extends R ? true : false
|
|
237
|
+
extends_any: T extends any ? true : false
|
|
238
|
+
extends_unknown: T extends unknown ? true : false
|
|
239
|
+
extends_void: T extends void ? true : false
|
|
240
|
+
extends_never: T extends never ? true : false
|
|
241
|
+
extends_undefined: T extends undefined ? true : false
|
|
242
|
+
extends_null: T extends null ? true : false
|
|
243
|
+
extends_boolean: T extends boolean ? true : false
|
|
244
|
+
extends_true: T extends true ? true : false
|
|
245
|
+
extends_false: T extends false ? true : false
|
|
246
|
+
extends_number: T extends number ? true : false
|
|
247
|
+
extends_1: T extends 1 ? true : false
|
|
248
|
+
extends_bigint: T extends bigint ? true : false
|
|
249
|
+
extends_1n: T extends 1n ? true : false
|
|
250
|
+
extends_string: T extends string ? true : false
|
|
251
|
+
extends_a: T extends 'a' ? true : false
|
|
252
|
+
extends_symbol: T extends symbol ? true : false
|
|
253
|
+
extends_object: T extends object ? true : false
|
|
254
|
+
extends_function: T extends Function ? true : false
|
|
255
|
+
extends_array_unknown: T extends unknown[] ? true : false
|
|
256
|
+
extends_tuple_empty: T extends [] ? true : false
|
|
257
|
+
union<R>(): T | R
|
|
258
|
+
union_any: T | any
|
|
259
|
+
union_unknown: T | unknown
|
|
260
|
+
union_void: T | void
|
|
261
|
+
union_never: T | never
|
|
262
|
+
union_undefined: T | undefined
|
|
263
|
+
union_null: T | null
|
|
264
|
+
union_boolean: T | boolean
|
|
265
|
+
union_true: T | true
|
|
266
|
+
union_false: T | false
|
|
267
|
+
union_number: T | number
|
|
268
|
+
union_1: T | 1
|
|
269
|
+
union_bigint: T | bigint
|
|
270
|
+
union_1n: T | 1n
|
|
271
|
+
union_string: T | string
|
|
272
|
+
union_a: T | 'a'
|
|
273
|
+
union_symbol: T | symbol
|
|
274
|
+
union_object: T | object
|
|
275
|
+
union_function: T | Function
|
|
276
|
+
union_array_unknown: T | unknown[]
|
|
277
|
+
union_tuple_empty: T | []
|
|
278
|
+
intersect<R>(): T & R
|
|
279
|
+
intersect_any: T & any
|
|
280
|
+
intersect_unknown: T & unknown
|
|
281
|
+
intersect_void: T & void
|
|
282
|
+
intersect_never: T & never
|
|
283
|
+
intersect_undefined: T & undefined
|
|
284
|
+
intersect_null: T & null
|
|
285
|
+
intersect_boolean: T & boolean
|
|
286
|
+
intersect_true: T & true
|
|
287
|
+
intersect_false: T & false
|
|
288
|
+
intersect_number: T & number
|
|
289
|
+
intersect_1: T & 1
|
|
290
|
+
intersect_bigint: T & bigint
|
|
291
|
+
intersect_1n: T & 1n
|
|
292
|
+
intersect_string: T & string
|
|
293
|
+
intersect_a: T & 'a'
|
|
294
|
+
intersect_symbol: T & symbol
|
|
295
|
+
intersect_object: T & object
|
|
296
|
+
intersect_function: T & Function
|
|
297
|
+
intersect_array_unknown: T & unknown[]
|
|
298
298
|
intersect_tuple_empty: T & []
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -24,13 +24,10 @@ export type CommonPropKeys<
|
|
|
24
24
|
Options extends CommonPropKeys.Options = CommonPropKeys.DefaultOptions
|
|
25
25
|
> = number extends T['length'] ? ArrayCommonPropKeys<T> : TupleCommonPropKeys<T, Options>
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
export namespace CommonPropKeys {
|
|
29
|
-
export interface Options extends TupleCommonPropKeys.Options {
|
|
30
|
-
}
|
|
28
|
+
export interface Options extends TupleCommonPropKeys.Options {}
|
|
31
29
|
|
|
32
|
-
export interface DefaultOptions extends TupleCommonPropKeys.DefaultOptions {
|
|
33
|
-
}
|
|
30
|
+
export interface DefaultOptions extends TupleCommonPropKeys.DefaultOptions {}
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
/**
|
|
@@ -11,32 +11,32 @@ import type { IsPositive } from '../numeric/is_positive.js'
|
|
|
11
11
|
export type CreateTuple<L extends number, T = unknown, Fail = never> = number extends L
|
|
12
12
|
? T[]
|
|
13
13
|
: IsPositive<L> extends true
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
? IsInteger<L> extends true
|
|
15
|
+
? ToTuple<[], DigitArray.FromString<`${L}`>, T>
|
|
16
|
+
: Fail
|
|
16
17
|
: Fail
|
|
17
|
-
: Fail
|
|
18
18
|
export type ToTuple<R extends any[], S extends number[], X = any> = S['length'] extends 0
|
|
19
19
|
? R
|
|
20
20
|
: S['length'] extends 1
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
? [...R, ...DigitToTuple<X>[S[0]]]
|
|
22
|
+
: S extends [any, ...infer T]
|
|
23
|
+
? T extends any[]
|
|
24
|
+
? ToTuple<Multi10<[...R, ...DigitToTuple<X>[S[0]]]>, T>
|
|
25
|
+
: never
|
|
26
|
+
: never
|
|
27
27
|
|
|
28
28
|
type DigitToTuple<T = 1> = {
|
|
29
29
|
[k in number]: any[]
|
|
30
30
|
} & {
|
|
31
|
-
0: []
|
|
32
|
-
1: [T]
|
|
33
|
-
2: [T, T]
|
|
34
|
-
3: [T, T, T]
|
|
35
|
-
4: [T, T, T, T]
|
|
36
|
-
5: [T, T, T, T, T]
|
|
37
|
-
6: [T, T, T, T, T, T]
|
|
38
|
-
7: [T, T, T, T, T, T, T]
|
|
39
|
-
8: [T, T, T, T, T, T, T, T]
|
|
31
|
+
0: []
|
|
32
|
+
1: [T]
|
|
33
|
+
2: [T, T]
|
|
34
|
+
3: [T, T, T]
|
|
35
|
+
4: [T, T, T, T]
|
|
36
|
+
5: [T, T, T, T, T]
|
|
37
|
+
6: [T, T, T, T, T, T]
|
|
38
|
+
7: [T, T, T, T, T, T, T]
|
|
39
|
+
8: [T, T, T, T, T, T, T, T]
|
|
40
40
|
9: [T, T, T, T, T, T, T, T, T]
|
|
41
41
|
}
|
|
42
42
|
type Multi10<C extends any[]> = [...C, ...C, ...C, ...C, ...C, ...C, ...C, ...C, ...C, ...C]
|
package/src/tuple/drop.ts
CHANGED
|
@@ -29,20 +29,20 @@ export type DropFirst<
|
|
|
29
29
|
> = number extends T['length']
|
|
30
30
|
? Options['$array']
|
|
31
31
|
: T['length'] extends 0
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
? Options['caseEmptyTuple']
|
|
33
|
+
: T['length'] extends 1
|
|
34
|
+
? []
|
|
35
|
+
: T extends [any, ...infer Tail]
|
|
36
|
+
? Tail
|
|
37
|
+
: never
|
|
38
38
|
|
|
39
39
|
export namespace DropFirst {
|
|
40
40
|
export interface Options {
|
|
41
|
-
$array?: unknown
|
|
42
|
-
caseEmptyTuple?: unknown
|
|
41
|
+
$array?: unknown
|
|
42
|
+
caseEmptyTuple?: unknown
|
|
43
43
|
}
|
|
44
44
|
export interface DefaultOptions<T> {
|
|
45
|
-
$array: T
|
|
45
|
+
$array: T
|
|
46
46
|
caseEmptyTuple: []
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -75,26 +75,24 @@ export type DropLast<
|
|
|
75
75
|
> = number extends T['length']
|
|
76
76
|
? Cases['$array']
|
|
77
77
|
: T['length'] extends 0
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
? Cases['caseEmptyTuple']
|
|
79
|
+
: T['length'] extends 1
|
|
80
|
+
? []
|
|
81
|
+
: T extends [...infer Heads, any]
|
|
82
|
+
? Heads
|
|
83
|
+
: never
|
|
85
84
|
|
|
86
85
|
export namespace DropLast {
|
|
87
86
|
export interface Options {
|
|
88
|
-
$array?: unknown
|
|
89
|
-
caseEmptyTuple?: unknown
|
|
87
|
+
$array?: unknown
|
|
88
|
+
caseEmptyTuple?: unknown
|
|
90
89
|
}
|
|
91
90
|
export interface DefaultOptions<T> {
|
|
92
|
-
$array: T
|
|
91
|
+
$array: T
|
|
93
92
|
caseEmptyTuple: []
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
98
96
|
/**
|
|
99
97
|
* ⚗️ *transform*
|
|
100
98
|
*
|
|
@@ -107,7 +105,7 @@ export namespace DropLast {
|
|
|
107
105
|
* type R = DropMatch<Array<1 | 2>, number> // never[]
|
|
108
106
|
* ```
|
|
109
107
|
*/
|
|
110
|
-
export type DropMatch<A extends Readonly<Array<unknown>>, Criteria> =
|
|
108
|
+
export type DropMatch<A extends Readonly<Array<unknown>>, Criteria> = number extends A['length']
|
|
111
109
|
? ArrayDropMatch<A, Criteria>
|
|
112
110
|
: TupleDropMatch<A, Criteria>
|
|
113
111
|
|
|
@@ -121,5 +119,5 @@ export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>
|
|
|
121
119
|
* 💀 *deprecated* the type does not sufficiently cover the use cases.
|
|
122
120
|
*/
|
|
123
121
|
export function drop<A extends Readonly<unknown[]>, const C>(array: A, value: C): DropMatch<A, C> {
|
|
124
|
-
return array.filter(v => v !== value) as DropMatch<A, C>
|
|
122
|
+
return array.filter((v) => v !== value) as DropMatch<A, C>
|
|
125
123
|
}
|
|
@@ -55,13 +55,12 @@ import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
|
55
55
|
* type R = IsNotTuple<[], IsNotTuple.$Branch> // $Else
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export type IsNotTuple<
|
|
58
|
+
export type IsNotTuple<T, $O extends IsNotTuple.$Options = {}> = $SpecialType<
|
|
59
59
|
T,
|
|
60
|
-
$
|
|
61
|
-
|
|
62
|
-
$MergeOptions<$O,
|
|
60
|
+
$MergeOptions<
|
|
61
|
+
$O,
|
|
63
62
|
{
|
|
64
|
-
$then: $ResolveBranch<T, $O, [$Then]
|
|
63
|
+
$then: $ResolveBranch<T, $O, [$Then]>
|
|
65
64
|
$else: IsNotTuple.$<T, $O>
|
|
66
65
|
}
|
|
67
66
|
>
|
|
@@ -80,22 +79,21 @@ export namespace IsNotTuple {
|
|
|
80
79
|
* This is a type util for building custom types.
|
|
81
80
|
* It does not check against special types.
|
|
82
81
|
*/
|
|
83
|
-
export type $<T, $O extends $UtilOptions> = $IsDistributive
|
|
84
|
-
$
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}>
|
|
82
|
+
export type $<T, $O extends $UtilOptions> = $IsDistributive<
|
|
83
|
+
$O,
|
|
84
|
+
{
|
|
85
|
+
$then: T extends readonly any[]
|
|
86
|
+
? number extends T['length']
|
|
87
|
+
? $ResolveBranch<T, $O, [$Then]>
|
|
88
|
+
: $ResolveBranch<T, $O, [$Else]>
|
|
89
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
90
|
+
$else: [T] extends [readonly any[]]
|
|
91
|
+
? number extends T['length']
|
|
92
|
+
? $ResolveBranch<T, $O, [$Then]>
|
|
93
|
+
: $ResolveBranch<T, $O, [$Else]>
|
|
94
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
99
97
|
|
|
100
98
|
export type $UtilOptions = NotAssignable.$UtilOptions
|
|
101
99
|
}
|
package/src/tuple/is_tuple.ts
CHANGED
|
@@ -53,18 +53,16 @@ import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
|
53
53
|
* type R = IsTuple<string, IsTuple.$Branch> // $Else
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
export type IsTuple<
|
|
56
|
+
export type IsTuple<T, $O extends IsTuple.$Options = {}> = $SpecialType<
|
|
57
57
|
T,
|
|
58
|
-
$
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
$else: IsTuple.$<T, $O>
|
|
65
|
-
}
|
|
66
|
-
>
|
|
58
|
+
$MergeOptions<
|
|
59
|
+
$O,
|
|
60
|
+
{
|
|
61
|
+
$then: $ResolveBranch<T, $O, [$Else]>
|
|
62
|
+
$else: IsTuple.$<T, $O>
|
|
63
|
+
}
|
|
67
64
|
>
|
|
65
|
+
>
|
|
68
66
|
|
|
69
67
|
export namespace IsTuple {
|
|
70
68
|
export type $Options = $Equality.$Options
|
|
@@ -78,22 +76,21 @@ export namespace IsTuple {
|
|
|
78
76
|
* This is a type util for building custom types.
|
|
79
77
|
* It does not check against special types.
|
|
80
78
|
*/
|
|
81
|
-
export type $<T, $O extends $UtilOptions> = $IsDistributive
|
|
82
|
-
$
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}>
|
|
79
|
+
export type $<T, $O extends $UtilOptions> = $IsDistributive<
|
|
80
|
+
$O,
|
|
81
|
+
{
|
|
82
|
+
$then: T extends readonly any[]
|
|
83
|
+
? number extends T['length']
|
|
84
|
+
? $ResolveBranch<T, $O, [$Else]>
|
|
85
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
86
|
+
: $ResolveBranch<T, $O, [$Else]>
|
|
87
|
+
$else: [T] extends [readonly any[]]
|
|
88
|
+
? number extends T['length']
|
|
89
|
+
? $ResolveBranch<T, $O, [$Else]>
|
|
90
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
91
|
+
: $ResolveBranch<T, $O, [$Else]>
|
|
92
|
+
}
|
|
93
|
+
>
|
|
97
94
|
|
|
98
95
|
export type $UtilOptions = Assignable.$UtilOptions
|
|
99
96
|
}
|
package/src/tuple/tail.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { UnionOfValues } from '../array/union_of_values.js'
|
|
|
5
5
|
*/
|
|
6
6
|
export type Tail<T extends readonly unknown[]> = T['length'] extends 0
|
|
7
7
|
? never
|
|
8
|
-
:
|
|
9
|
-
? Tail extends UnionOfValues<T>[]
|
|
10
|
-
|
|
8
|
+
: T extends readonly [any, ...infer Tail]
|
|
9
|
+
? Tail extends UnionOfValues<T>[]
|
|
10
|
+
? Tail
|
|
11
|
+
: never
|
|
12
|
+
: T
|
|
@@ -26,25 +26,19 @@ export type CommonPropKeys<
|
|
|
26
26
|
> = IsNever<
|
|
27
27
|
T,
|
|
28
28
|
{
|
|
29
|
-
$then: Options['$never']
|
|
30
|
-
$else:
|
|
29
|
+
$then: Options['$never']
|
|
30
|
+
$else: T['length'] extends 0
|
|
31
31
|
? never
|
|
32
|
-
:
|
|
33
|
-
T['length'] extends 1
|
|
32
|
+
: T['length'] extends 1
|
|
34
33
|
? keyof T[0]
|
|
35
|
-
:
|
|
36
|
-
T['length'] extends 2
|
|
34
|
+
: T['length'] extends 2
|
|
37
35
|
? keyof T[0] & keyof T[1]
|
|
38
36
|
: keyof T[0] & keyof T[1] & CommonPropKeys<Tail<Tail<T>>>
|
|
39
|
-
)
|
|
40
|
-
))
|
|
41
37
|
}
|
|
42
38
|
>
|
|
43
39
|
|
|
44
40
|
export namespace CommonPropKeys {
|
|
45
|
-
export interface Options extends $Never.$Options {
|
|
46
|
-
}
|
|
41
|
+
export interface Options extends $Never.$Options {}
|
|
47
42
|
|
|
48
|
-
export interface DefaultOptions extends $Never.$Default {
|
|
49
|
-
}
|
|
43
|
+
export interface DefaultOptions extends $Never.$Default {}
|
|
50
44
|
}
|
|
@@ -2,18 +2,18 @@ import type { IsEqual } from '../equal/equal.js'
|
|
|
2
2
|
|
|
3
3
|
export type DropMatch<A extends Readonly<Array<unknown>>, Criteria> = A['length'] extends 0
|
|
4
4
|
? // empty tuple
|
|
5
|
-
|
|
5
|
+
A
|
|
6
6
|
: A extends readonly [infer Head, ...infer Tail]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
? Tail['length'] extends 0
|
|
8
|
+
? // single element tuple
|
|
9
|
+
undefined extends Criteria
|
|
10
|
+
? DropMatch.ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]>
|
|
11
|
+
: DropMatch.ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]>
|
|
12
|
+
: // multiple elements
|
|
13
|
+
Exclude<Head, Criteria> extends never
|
|
14
|
+
? DropMatch<Tail, Criteria>
|
|
15
|
+
: [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>]
|
|
16
|
+
: never[]
|
|
17
17
|
|
|
18
18
|
export namespace DropMatch {
|
|
19
19
|
export type ExcludeUnionOfEmptyTuple<A> = IsEqual<A, []> extends true ? A : Exclude<A, []>
|