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
|
@@ -59,10 +59,12 @@ import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
|
59
59
|
* type R = IsBoolean<string, $SelectionBranch> // $Else
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export type IsBoolean<T, $O extends IsBoolean.$Options = {}> = $SpecialType<
|
|
63
|
-
|
|
62
|
+
export type IsBoolean<T, $O extends IsBoolean.$Options = {}> = $SpecialType<
|
|
63
|
+
T,
|
|
64
|
+
$MergeOptions<
|
|
65
|
+
$O,
|
|
64
66
|
{
|
|
65
|
-
$then: $ResolveBranch<T, $O, [$Else]
|
|
67
|
+
$then: $ResolveBranch<T, $O, [$Else]>
|
|
66
68
|
$else: IsBoolean.$<T, $O>
|
|
67
69
|
}
|
|
68
70
|
>
|
|
@@ -79,48 +81,58 @@ export namespace IsBoolean {
|
|
|
79
81
|
* This is a type util for building custom types.
|
|
80
82
|
* It does not check against special types.
|
|
81
83
|
*/
|
|
82
|
-
export type $<T, $O extends $UtilOptions> =
|
|
83
|
-
$
|
|
84
|
-
? $IsDistributive<$O, { $then: _SD<T, $O>, $else: _N<T, $O> }>
|
|
84
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
|
|
85
|
+
? $IsDistributive<$O, { $then: _SD<T, $O>; $else: _N<T, $O> }>
|
|
85
86
|
: Assignable.$<T, boolean, $O>
|
|
86
87
|
export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
|
|
87
88
|
|
|
88
|
-
export type _SD<T, $O extends $Options> =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
export type _SD<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
|
|
90
|
+
? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
|
|
91
|
+
? $ResolveBranch<boolean, $O, [$Then]> | $ResolveBranch<Exclude<T, boolean>, $O, [$Else]>
|
|
92
|
+
: ['aBcD' | 'AbCd'] extends [R]
|
|
93
|
+
? $ResolveBranch<T, $O, [$Then]>
|
|
94
|
+
: ['aBcd' | 'Abcd'] extends [R]
|
|
95
|
+
? $ResolveBranch<T, $O, [$Then]>
|
|
96
|
+
: $ResolveBranch<T, $O, [$Else]>
|
|
93
97
|
: never
|
|
94
98
|
|
|
95
|
-
export type _N<T, $O extends $Options> =
|
|
96
|
-
[T] extends [
|
|
97
|
-
? (
|
|
98
|
-
[T] extends [true]
|
|
99
|
+
export type _N<T, $O extends $Options> = [T] extends [boolean]
|
|
100
|
+
? [T] extends [true]
|
|
99
101
|
? $ResolveBranch<T, $O, [$Else]>
|
|
100
|
-
:
|
|
101
|
-
[T] extends [false]
|
|
102
|
+
: [T] extends [false]
|
|
102
103
|
? $ResolveBranch<T, $O, [$Else]>
|
|
103
104
|
: $ResolveBranch<T, $O, [$Then]>
|
|
104
|
-
)
|
|
105
|
-
)
|
|
106
105
|
: $ResolveBranch<T, $O, [$Else]>
|
|
107
106
|
|
|
108
107
|
export type _DistributeMap<T> = T extends true
|
|
109
|
-
?
|
|
110
|
-
?
|
|
111
|
-
?
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
? T extends false
|
|
109
|
+
? true extends T
|
|
110
|
+
? false extends T
|
|
111
|
+
? 'ABCD'
|
|
112
|
+
: 'ABCd'
|
|
113
|
+
: false extends T
|
|
114
|
+
? 'ABcD'
|
|
115
|
+
: 'ABcd'
|
|
116
|
+
: true extends T
|
|
117
|
+
? false extends T
|
|
118
|
+
? 'AbCD'
|
|
119
|
+
: 'AbCd'
|
|
120
|
+
: false extends T
|
|
121
|
+
? 'AbcD'
|
|
122
|
+
: 'Abcd'
|
|
123
|
+
: T extends false
|
|
124
|
+
? true extends T
|
|
125
|
+
? false extends T
|
|
126
|
+
? 'aBCD'
|
|
127
|
+
: 'aBCd'
|
|
128
|
+
: false extends T
|
|
129
|
+
? 'aBcD'
|
|
130
|
+
: 'aBcd'
|
|
131
|
+
: true extends T
|
|
132
|
+
? false extends T
|
|
133
|
+
? 'abCD'
|
|
134
|
+
: 'abCd'
|
|
135
|
+
: false extends T
|
|
136
|
+
? 'abcD'
|
|
137
|
+
: 'abcd'
|
|
126
138
|
}
|
package/src/boolean/is_false.ts
CHANGED
|
@@ -58,10 +58,12 @@ import type { $Else } from '../type_plus/branch/$selection.js'
|
|
|
58
58
|
* type R = IsFalse<string, $SelectionBranch> // $Else
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
export type IsFalse<T, $O extends IsFalse.$Options = {}> = $SpecialType<
|
|
62
|
-
|
|
61
|
+
export type IsFalse<T, $O extends IsFalse.$Options = {}> = $SpecialType<
|
|
62
|
+
T,
|
|
63
|
+
$MergeOptions<
|
|
64
|
+
$O,
|
|
63
65
|
{
|
|
64
|
-
$then: $ResolveBranch<T, $O, [$Else]
|
|
66
|
+
$then: $ResolveBranch<T, $O, [$Else]>
|
|
65
67
|
$else: IsFalse.$<T, $O>
|
|
66
68
|
}
|
|
67
69
|
>
|
|
@@ -23,7 +23,7 @@ import type { IsBoolean } from './is_boolean.js'
|
|
|
23
23
|
* type R = IsNotBoolean<number> // true
|
|
24
24
|
* type R = IsNotBoolean<unknown> // true
|
|
25
25
|
* type R = IsNotBoolean<string | boolean> // boolean
|
|
26
|
-
|
|
26
|
+
* ```
|
|
27
27
|
*
|
|
28
28
|
* 🔢 *customize*
|
|
29
29
|
*
|
|
@@ -60,15 +60,16 @@ import type { IsBoolean } from './is_boolean.js'
|
|
|
60
60
|
* type R = IsNotBoolean<string, $SelectionBranch> // $Then
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export type IsNotBoolean<T, $O extends IsNotBoolean.$Options = {}> =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
export type IsNotBoolean<T, $O extends IsNotBoolean.$Options = {}> = $SpecialType<
|
|
64
|
+
T,
|
|
65
|
+
$MergeOptions<
|
|
66
|
+
$O,
|
|
67
|
+
{
|
|
68
|
+
$then: $ResolveBranch<T, $O, [$Then]>
|
|
69
|
+
$else: IsNotBoolean.$<T, $O>
|
|
70
|
+
}
|
|
71
71
|
>
|
|
72
|
+
>
|
|
72
73
|
|
|
73
74
|
export namespace IsNotBoolean {
|
|
74
75
|
export type $Options = $Equality.$Options & $Exact.$Options
|
|
@@ -82,28 +83,25 @@ export namespace IsNotBoolean {
|
|
|
82
83
|
* This is a type util for building custom types.
|
|
83
84
|
* It does not check against special types.
|
|
84
85
|
*/
|
|
85
|
-
export type $<T, $O extends $UtilOptions> =
|
|
86
|
-
$
|
|
87
|
-
? $IsDistributive<$O, { $then: _D<T, $O>, $else: _N<T, $O> }>
|
|
86
|
+
export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
|
|
87
|
+
? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
|
|
88
88
|
: NotAssignable.$<T, boolean, $O>
|
|
89
89
|
export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
|
|
90
90
|
|
|
91
|
-
export type _D<T, $O extends $Options> =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
export type _D<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
|
|
92
|
+
? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
|
|
93
|
+
? $ResolveBranch<Exclude<T, boolean>, $O, [$Then | $Else]>
|
|
94
|
+
: ['aBcD' | 'AbCd'] extends [R]
|
|
95
|
+
? $ResolveBranch<T, $O, [$Else]>
|
|
96
|
+
: ['aBcd' | 'Abcd'] extends [R]
|
|
97
|
+
? $ResolveBranch<T, $O, [$Else]>
|
|
98
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
96
99
|
: never
|
|
97
|
-
export type _N<T, $O extends $Options> =
|
|
98
|
-
[T] extends [
|
|
99
|
-
? (
|
|
100
|
-
[T] extends [true]
|
|
100
|
+
export type _N<T, $O extends $Options> = [T] extends [boolean]
|
|
101
|
+
? [T] extends [true]
|
|
101
102
|
? $ResolveBranch<T, $O, [$Then]>
|
|
102
|
-
:
|
|
103
|
-
[T] extends [false]
|
|
103
|
+
: [T] extends [false]
|
|
104
104
|
? $ResolveBranch<T, $O, [$Then]>
|
|
105
105
|
: $ResolveBranch<T, $O, [$Else]>
|
|
106
|
-
)
|
|
107
|
-
)
|
|
108
106
|
: $ResolveBranch<T, $O, [$Then]>
|
|
109
107
|
}
|
|
@@ -59,10 +59,12 @@ import type { $Then } from '../type_plus/branch/$selection.js'
|
|
|
59
59
|
* type R = IsNotFalse<string, $SelectionBranch> // $Then
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export type IsNotFalse<T, $O extends IsNotFalse.$Options = {}> = $SpecialType<
|
|
63
|
-
|
|
62
|
+
export type IsNotFalse<T, $O extends IsNotFalse.$Options = {}> = $SpecialType<
|
|
63
|
+
T,
|
|
64
|
+
$MergeOptions<
|
|
65
|
+
$O,
|
|
64
66
|
{
|
|
65
|
-
$then: $ResolveBranch<T, $O, [$Then]
|
|
67
|
+
$then: $ResolveBranch<T, $O, [$Then]>
|
|
66
68
|
$else: IsNotFalse.$<T, $O>
|
|
67
69
|
}
|
|
68
70
|
>
|
|
@@ -60,10 +60,12 @@ import type { $Then } from '../type_plus/branch/$selection.js'
|
|
|
60
60
|
* type R = IsNotTrue<string, $SelectionBranch> // $Then
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export type IsNotTrue<T, $O extends IsNotTrue.$Options = {}> = $SpecialType<
|
|
64
|
-
|
|
63
|
+
export type IsNotTrue<T, $O extends IsNotTrue.$Options = {}> = $SpecialType<
|
|
64
|
+
T,
|
|
65
|
+
$MergeOptions<
|
|
66
|
+
$O,
|
|
65
67
|
{
|
|
66
|
-
$then: $ResolveBranch<T, $O, [$Then]
|
|
68
|
+
$then: $ResolveBranch<T, $O, [$Then]>
|
|
67
69
|
$else: IsNotTrue.$<T, $O>
|
|
68
70
|
}
|
|
69
71
|
>
|
package/src/boolean/is_true.ts
CHANGED
|
@@ -58,10 +58,12 @@ import type { $Else } from '../type_plus/branch/$selection.js'
|
|
|
58
58
|
* type R = IsTrue<string, $SelectionBranch> // $Else
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
export type IsTrue<T, $O extends IsTrue.$Options = {}> = $SpecialType<
|
|
62
|
-
|
|
61
|
+
export type IsTrue<T, $O extends IsTrue.$Options = {}> = $SpecialType<
|
|
62
|
+
T,
|
|
63
|
+
$MergeOptions<
|
|
64
|
+
$O,
|
|
63
65
|
{
|
|
64
|
-
$then: $ResolveBranch<T, $O, [$Else]
|
|
66
|
+
$then: $ResolveBranch<T, $O, [$Else]>
|
|
65
67
|
$else: IsTrue.$<T, $O>
|
|
66
68
|
}
|
|
67
69
|
>
|
|
@@ -13,7 +13,7 @@ import type { AnyConstructor } from './AnyConstructor.js'
|
|
|
13
13
|
*/
|
|
14
14
|
export function isConstructor(subject: unknown): subject is AnyConstructor {
|
|
15
15
|
try {
|
|
16
|
-
new (subject as AnyConstructor)()
|
|
16
|
+
;new (subject as AnyConstructor)()
|
|
17
17
|
} catch (err: any) {
|
|
18
18
|
const msg = err?.message as string | undefined
|
|
19
19
|
if (msg && msg.indexOf('is not a constructor') >= 0) {
|
package/src/equal/equal.ts
CHANGED
|
@@ -6,12 +6,7 @@ import type { And, Or } from '../predicates/logical.js'
|
|
|
6
6
|
import type { IsSymbol } from '../symbol/is_symbol.js'
|
|
7
7
|
import type { IdentityEqual } from './identity_equal.js'
|
|
8
8
|
|
|
9
|
-
type BothNever<A, B, Both, One, None> = And<
|
|
10
|
-
IsNever<A>,
|
|
11
|
-
IsNever<B>,
|
|
12
|
-
Both,
|
|
13
|
-
Or<IsNever<A>, IsNever<B>, One, None>
|
|
14
|
-
>
|
|
9
|
+
type BothNever<A, B, Both, One, None> = And<IsNever<A>, IsNever<B>, Both, Or<IsNever<A>, IsNever<B>, One, None>>
|
|
15
10
|
|
|
16
11
|
type BothAny<A, B, Both, One, None> = And<IsAny<A>, IsAny<B>, Both, Or<IsAny<A>, IsAny<B>, One, None>>
|
|
17
12
|
|
|
@@ -37,37 +32,37 @@ type BothAny<A, B, Both, One, None> = And<IsAny<A>, IsAny<B>, Both, Or<IsAny<A>,
|
|
|
37
32
|
*/
|
|
38
33
|
export type IsEqual<A, B, Then = true, Else = false> = [A, B] extends [B, A]
|
|
39
34
|
? BothNever<
|
|
40
|
-
A,
|
|
41
|
-
B,
|
|
42
|
-
Then,
|
|
43
|
-
Else,
|
|
44
|
-
BothAny<
|
|
45
35
|
A,
|
|
46
36
|
B,
|
|
47
37
|
Then,
|
|
48
38
|
Else,
|
|
49
|
-
|
|
39
|
+
BothAny<
|
|
50
40
|
A,
|
|
51
41
|
B,
|
|
52
42
|
Then,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
Else,
|
|
44
|
+
IdentityEqual<
|
|
45
|
+
A,
|
|
46
|
+
B,
|
|
47
|
+
Then,
|
|
48
|
+
And<
|
|
49
|
+
IsObject<A>,
|
|
50
|
+
IsObject<B>,
|
|
51
|
+
IdentityEqual<
|
|
52
|
+
Properties<A>,
|
|
53
|
+
Properties<B>,
|
|
54
|
+
[A, B] extends [(...args: infer P1) => any, (...args: infer P2) => any]
|
|
55
|
+
? IsEqual<P1, P2, Then, Else>
|
|
56
|
+
: Then,
|
|
57
|
+
Else
|
|
58
|
+
>,
|
|
59
|
+
// `A` and `B` are narrowed, need to check again.
|
|
60
|
+
// This is fixed in TS 5.0.2, but keeping it to support older versions.
|
|
61
|
+
[A, B] extends [B, A] ? Then : Else
|
|
62
|
+
>
|
|
67
63
|
>
|
|
68
64
|
>
|
|
69
65
|
>
|
|
70
|
-
>
|
|
71
66
|
: And<IsSymbol<A, { distributive: false }>, IsSymbol<B, { distributive: false }>, Then, Else>
|
|
72
67
|
|
|
73
68
|
/**
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* This is a common equal check.
|
|
4
3
|
* It is good for some basic cases, but not for all.
|
|
5
4
|
*/
|
|
6
|
-
export type IdentityEqual<A, B, Then, Else> =
|
|
7
|
-
|
|
5
|
+
export type IdentityEqual<A, B, Then, Else> = (<_>() => _ extends (A & _) | _ ? 1 : 2) extends <_>() => _ extends
|
|
6
|
+
| (B & _)
|
|
7
|
+
| _
|
|
8
|
+
? 1
|
|
9
|
+
: 2
|
|
8
10
|
? Then
|
|
9
11
|
: Else
|
|
@@ -15,9 +15,7 @@ import type { AnyFunction } from './any_function.js'
|
|
|
15
15
|
* }> // () => void
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export type ExtractFunction<T extends AnyFunction> = T extends AnyFunction<infer P, infer R>
|
|
19
|
-
? (...args: P) => R
|
|
20
|
-
: never
|
|
18
|
+
export type ExtractFunction<T extends AnyFunction> = T extends AnyFunction<infer P, infer R> ? (...args: P) => R : never
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* Extract the function signature from a composite function.
|
|
@@ -18,23 +18,23 @@ import type { $Unknown } from '../unknown/unknown.js'
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
export type IsNotStrictFunction<T, $O extends IsNotStrictFunction.$Options = {}> = $SpecialType<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
$
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
export type IsNotStrictFunction<T, $O extends IsNotStrictFunction.$Options = {}> = $SpecialType<
|
|
22
|
+
T,
|
|
23
|
+
{
|
|
24
|
+
$any: $ResolveBranch<T, $O, [$Any, $Then]>
|
|
25
|
+
$unknown: $ResolveBranch<T, $O, [$Unknown, $Then]>
|
|
26
|
+
$never: $ResolveBranch<T, $O, [$Never, $Then]>
|
|
27
|
+
$else: $ResolveOptions<[$O['distributive'], $SelectInvertStrict.$Default['distributive']]> extends true
|
|
28
|
+
? IsNotStrictFunction._D<T, $O>
|
|
29
|
+
: $SelectInvertStrict._N<T, Function, $O>
|
|
30
|
+
}
|
|
31
|
+
>
|
|
31
32
|
|
|
32
33
|
export namespace IsNotStrictFunction {
|
|
33
34
|
export type $Options = $SelectInvertStrict.$Options
|
|
34
35
|
export type $Default = $SelectInvertStrict.$Default
|
|
35
36
|
export type $Branch = $SelectInvertStrict.$Branch
|
|
36
|
-
export type _D<T, $O extends IsNotStrictFunction.$Options> =
|
|
37
|
-
T extends Function
|
|
37
|
+
export type _D<T, $O extends IsNotStrictFunction.$Options> = T extends Function
|
|
38
38
|
? $ResolveBranch<T, $O, [T extends (...args: any[]) => any ? $Then : $Else]>
|
|
39
39
|
: $ResolveBranch<T, $O, [$Then]>
|
|
40
40
|
}
|
|
@@ -17,27 +17,25 @@ import type { $Unknown } from '../unknown/unknown.js'
|
|
|
17
17
|
* type R = IsStrictFunction<(() => void) & { a: 1 }> // false
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
export type IsStrictFunction<T, $O extends IsStrictFunction.$Options = {}> =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
$else: $ResolveOptions<[$O['distributive'], $SelectStrict.$Default['distributive']]> extends true
|
|
20
|
+
export type IsStrictFunction<T, $O extends IsStrictFunction.$Options = {}> = $SpecialType<
|
|
21
|
+
T,
|
|
22
|
+
{
|
|
23
|
+
$any: $ResolveBranch<T, $O, [$Any, $Else]>
|
|
24
|
+
$unknown: $ResolveBranch<T, $O, [$Unknown, $Else]>
|
|
25
|
+
$never: $ResolveBranch<T, $O, [$Never, $Else]>
|
|
26
|
+
$else: $ResolveOptions<[$O['distributive'], $SelectStrict.$Default['distributive']]> extends true
|
|
28
27
|
? IsStrictFunction._D<T, $O>
|
|
29
28
|
: $SelectStrict._N<T, Function, $O>
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
}
|
|
30
|
+
>
|
|
32
31
|
|
|
33
32
|
export namespace IsStrictFunction {
|
|
34
33
|
export type $Options = $SelectStrict.$Options
|
|
35
34
|
export type $Default = $SelectStrict.$Default
|
|
36
35
|
export type $Branch = $SelectStrict.$Branch
|
|
37
|
-
export type _D<T, $O extends $SelectStrict.$Options> =
|
|
38
|
-
T extends Function
|
|
36
|
+
export type _D<T, $O extends $SelectStrict.$Options> = T extends Function
|
|
39
37
|
? T extends (...args: any[]) => any
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
? $ResolveBranch<T, $O, [$Else]>
|
|
39
|
+
: $ResolveBranch<T, $O, [$Then]>
|
|
42
40
|
: $ResolveBranch<T, $O, [$Else]>
|
|
43
41
|
}
|
package/src/functional/Maybe.ts
CHANGED
|
@@ -6,9 +6,7 @@ export type Maybe<T> = Just<T> | None<T>
|
|
|
6
6
|
export type Just<T> = Brand<'maybe', T> & { unwrap(): T }
|
|
7
7
|
export type None<T> = Brand<'maybe', void> & { unwrap(): T }
|
|
8
8
|
|
|
9
|
-
export function just<T>(
|
|
10
|
-
value: T
|
|
11
|
-
): IsEqual<T, undefined | null> extends true ? None<T> : Just<Widen<NonNullable<T>>> {
|
|
9
|
+
export function just<T>(value: T): IsEqual<T, undefined | null> extends true ? None<T> : Just<Widen<NonNullable<T>>> {
|
|
12
10
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
13
11
|
return {
|
|
14
12
|
unwrap() {
|
|
@@ -9,10 +9,8 @@ import type { AnyFunction } from '../function/any_function.js'
|
|
|
9
9
|
* @return The composed function will expect the parameters of the first function,
|
|
10
10
|
* and return the result of the last function.
|
|
11
11
|
*/
|
|
12
|
-
export function compose<FS extends AnyFunction[]>(
|
|
13
|
-
...fns: FS
|
|
14
|
-
): (...args: Parameters<Head<FS>>) => ReturnType<Last<FS>> {
|
|
12
|
+
export function compose<FS extends AnyFunction[]>(...fns: FS): (...args: Parameters<Head<FS>>) => ReturnType<Last<FS>> {
|
|
15
13
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
16
14
|
// biome-ignore lint/performance/noAccumulatingSpread: https://github.com/biomejs/biome/issues/2183
|
|
17
|
-
|
|
15
|
+
return (...args: any[]) => fns.reduce((args, fn) => [fn(...args)], args)[0]
|
|
18
16
|
}
|
|
@@ -27,7 +27,7 @@ export type ContextBuilder<Init extends ContextBaseShape, Ctx extends ContextBas
|
|
|
27
27
|
*/
|
|
28
28
|
extend<Additional extends ContextBaseShape = ContextBaseShape>(
|
|
29
29
|
extender: ContextExtender<Ctx, Additional>
|
|
30
|
-
): ContextBuilder<Init, LeftJoin<Ctx, Additional
|
|
30
|
+
): ContextBuilder<Init, LeftJoin<Ctx, Additional>>
|
|
31
31
|
/**
|
|
32
32
|
* Build and return the context.
|
|
33
33
|
*/
|
package/src/index.ts
CHANGED
package/src/math/abs.ts
CHANGED
|
@@ -12,12 +12,22 @@ import type { $Else, $Then } from '../type_plus/branch/$selection.js'
|
|
|
12
12
|
* Abs<-1n> // 1n // Where `1n` is a bigint
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
export type Abs<N extends number | bigint, Fail = never> = IsNumber<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
export type Abs<N extends number | bigint, Fail = never> = IsNumber<N, IsNumber.$Branch> extends infer R
|
|
16
|
+
? R extends $Then
|
|
17
|
+
? [number] extends [N]
|
|
18
|
+
? Fail
|
|
19
|
+
: `${N}` extends `-${infer P extends number}`
|
|
20
|
+
? P
|
|
21
|
+
: N
|
|
22
|
+
: R extends $Else
|
|
23
|
+
? IsBigint<N> extends infer R
|
|
24
|
+
? R extends true
|
|
25
|
+
? [bigint] extends [N]
|
|
26
|
+
? Fail
|
|
27
|
+
: `${N}` extends `-${infer P extends bigint}`
|
|
28
|
+
? P
|
|
29
|
+
: N
|
|
30
|
+
: Fail
|
|
31
|
+
: never
|
|
32
|
+
: never
|
|
22
33
|
: never
|
|
23
|
-
: never : never
|
|
@@ -13,10 +13,10 @@ export type ToNegative<N extends number | bigint> = N extends number
|
|
|
13
13
|
? N extends 0
|
|
14
14
|
? 0
|
|
15
15
|
: `-${N}` extends `${infer W extends number}`
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
? W
|
|
17
|
+
: N
|
|
18
18
|
: N extends 0n
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
? 0n
|
|
20
|
+
: `-${N}` extends `${infer W extends bigint}`
|
|
21
|
+
? W
|
|
22
|
+
: N
|
package/src/math/max.ts
CHANGED