type-plus 8.0.0-beta.6 → 8.0.0-beta.8
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/type_plus → cjs/$type}/$resolve_options.d.ts +2 -2
- package/cjs/$type/$resolve_options.d.ts.map +1 -0
- package/cjs/$type/$resolve_options.js.map +1 -0
- package/cjs/$type/$type.d.ts +34 -0
- package/cjs/$type/$type.d.ts.map +1 -0
- package/cjs/{type_plus → $type}/$type.js.map +1 -1
- package/{esm/type_plus → cjs/$type}/branch/$branch.d.ts +3 -3
- package/cjs/$type/branch/$branch.d.ts.map +1 -0
- package/cjs/$type/branch/$branch.js.map +1 -0
- package/{esm/type_plus → cjs/$type}/branch/$input_options.d.ts +2 -1
- package/cjs/$type/branch/$input_options.d.ts.map +1 -0
- package/cjs/$type/branch/$input_options.js.map +1 -0
- package/cjs/$type/branch/$resolve_branch.d.ts +22 -0
- package/cjs/$type/branch/$resolve_branch.d.ts.map +1 -0
- package/cjs/$type/branch/$resolve_branch.js.map +1 -0
- package/cjs/$type/branch/$selection.d.ts +161 -0
- package/cjs/$type/branch/$selection.d.ts.map +1 -0
- package/cjs/$type/branch/$selection.js.map +1 -0
- package/cjs/$type/distributive/$distributive.d.ts +27 -0
- package/cjs/$type/distributive/$distributive.d.ts.map +1 -0
- package/cjs/$type/distributive/$distributive.js.map +1 -0
- package/cjs/$type/errors/$error.d.ts +23 -0
- package/cjs/$type/errors/$error.d.ts.map +1 -0
- package/cjs/{type_plus → $type/errors}/$error.js.map +1 -1
- package/{esm/type_plus → cjs/$type/errors}/$infer_error.d.ts +7 -6
- package/cjs/$type/errors/$infer_error.d.ts.map +1 -0
- package/cjs/$type/errors/$infer_error.js.map +1 -0
- package/{esm/type → cjs/$type/errors}/failed.d.ts +4 -0
- package/cjs/$type/errors/failed.d.ts.map +1 -0
- package/cjs/{type → $type/errors}/failed.js.map +1 -1
- package/cjs/$type/exact/$exact.d.ts +27 -0
- package/cjs/$type/exact/$exact.d.ts.map +1 -0
- package/cjs/{type_plus/branch → $type/exact}/$exact.js.map +1 -1
- package/cjs/$type/special/$any.d.ts +36 -0
- package/cjs/$type/special/$any.d.ts.map +1 -0
- package/cjs/{any/any.js → $type/special/$any.js} +1 -1
- package/cjs/$type/special/$any.js.map +1 -0
- package/cjs/$type/special/$never.d.ts +52 -0
- package/cjs/$type/special/$never.d.ts.map +1 -0
- package/cjs/$type/special/$never.js +3 -0
- package/cjs/$type/special/$never.js.map +1 -0
- package/cjs/$type/special/$special.d.ts +31 -0
- package/cjs/$type/special/$special.d.ts.map +1 -0
- package/cjs/$type/special/$special.js +3 -0
- package/cjs/$type/special/$special.js.map +1 -0
- package/cjs/$type/special/$unknown.d.ts +37 -0
- package/cjs/$type/special/$unknown.d.ts.map +1 -0
- package/cjs/$type/special/$unknown.js +3 -0
- package/cjs/$type/special/$unknown.js.map +1 -0
- package/cjs/$type/special/$void.d.ts +46 -0
- package/cjs/$type/special/$void.d.ts.map +1 -0
- package/cjs/{never/never.js → $type/special/$void.js} +1 -1
- package/cjs/$type/special/$void.js.map +1 -0
- package/cjs/$type/utils/$merge_options.d.ts +14 -0
- package/cjs/$type/utils/$merge_options.d.ts.map +1 -0
- package/cjs/$type/utils/$merge_options.js.map +1 -0
- package/cjs/any/is_any.d.ts +23 -20
- package/cjs/any/is_any.d.ts.map +1 -1
- package/cjs/any/is_not_any.d.ts +15 -14
- package/cjs/any/is_not_any.d.ts.map +1 -1
- package/cjs/array/array.reverse.d.ts +1 -1
- package/cjs/array/array.reverse.d.ts.map +1 -1
- package/cjs/array/array.some.d.ts +1 -1
- package/cjs/array/array.some.d.ts.map +1 -1
- package/cjs/array/array_plus.common_prop_keys.d.ts +1 -1
- package/cjs/array/array_plus.common_prop_keys.d.ts.map +1 -1
- package/cjs/array/array_plus.filter.d.ts +2 -2
- package/cjs/array/array_plus.filter.d.ts.map +1 -1
- package/cjs/array/array_plus.find.d.ts +2 -2
- package/cjs/array/array_plus.find.d.ts.map +1 -1
- package/cjs/array/array_plus.index_at.d.ts +16 -10
- package/cjs/array/array_plus.index_at.d.ts.map +1 -1
- package/cjs/array/array_plus.index_at.js.map +1 -1
- package/cjs/array/array_plus.is_readonly.d.ts +3 -3
- package/cjs/array/array_plus.is_readonly.d.ts.map +1 -1
- package/cjs/array/head.d.ts +3 -3
- package/cjs/array/head.d.ts.map +1 -1
- package/cjs/array/is_array.d.ts +23 -19
- package/cjs/array/is_array.d.ts.map +1 -1
- package/cjs/array/is_not_array.d.ts +23 -19
- package/cjs/array/is_not_array.d.ts.map +1 -1
- package/cjs/array/last.d.ts +5 -3
- package/cjs/array/last.d.ts.map +1 -1
- package/cjs/array/literal_array.js +1 -2
- package/cjs/array/literal_array.js.map +1 -1
- package/cjs/array/reduce_while.js +1 -2
- package/cjs/array/reduce_while.js.map +1 -1
- package/cjs/assertion/assert_type.d.ts +1 -1
- package/cjs/assertion/assert_type.d.ts.map +1 -1
- package/cjs/assertion/assert_type.js +1 -4
- package/cjs/assertion/assert_type.js.map +1 -1
- package/cjs/bigint/is_bigint.d.ts +20 -16
- package/cjs/bigint/is_bigint.d.ts.map +1 -1
- package/cjs/bigint/is_bigint_literal.d.ts +18 -13
- package/cjs/bigint/is_bigint_literal.d.ts.map +1 -1
- package/cjs/bigint/is_not_bigint.d.ts +20 -16
- package/cjs/bigint/is_not_bigint.d.ts.map +1 -1
- package/cjs/bigint/is_not_bigint_literal.d.ts +19 -13
- package/cjs/bigint/is_not_bigint_literal.d.ts.map +1 -1
- package/cjs/binary/_binary.d.ts +2 -1
- package/cjs/binary/_binary.d.ts.map +1 -1
- package/cjs/binary/_binary.js +3 -0
- package/cjs/binary/_binary.js.map +1 -1
- package/cjs/binary/bit.d.ts +26 -0
- package/cjs/binary/bit.d.ts.map +1 -0
- package/cjs/binary/{Bit.js → bit.js} +1 -1
- package/cjs/binary/bit.js.map +1 -0
- package/cjs/boolean/is_boolean.d.ts +20 -16
- package/cjs/boolean/is_boolean.d.ts.map +1 -1
- package/cjs/boolean/is_false.d.ts +15 -9
- package/cjs/boolean/is_false.d.ts.map +1 -1
- package/cjs/boolean/is_not_boolean.d.ts +21 -16
- package/cjs/boolean/is_not_boolean.d.ts.map +1 -1
- package/cjs/boolean/is_not_false.d.ts +16 -9
- package/cjs/boolean/is_not_false.d.ts.map +1 -1
- package/cjs/boolean/is_not_true.d.ts +15 -9
- package/cjs/boolean/is_not_true.d.ts.map +1 -1
- package/cjs/boolean/is_true.d.ts +15 -9
- package/cjs/boolean/is_true.d.ts.map +1 -1
- package/cjs/class/isConstructor.js +2 -3
- package/cjs/class/isConstructor.js.map +1 -1
- package/cjs/equal/equal.d.ts +189 -74
- package/cjs/equal/equal.d.ts.map +1 -1
- package/cjs/equal/identity_equal.d.ts +5 -1
- package/cjs/equal/identity_equal.d.ts.map +1 -1
- package/cjs/equal/is_equal.d.ts +102 -0
- package/cjs/equal/is_equal.d.ts.map +1 -0
- package/cjs/equal/is_equal.js +3 -0
- package/cjs/equal/is_equal.js.map +1 -0
- package/cjs/function/extract_function.d.ts.map +1 -1
- package/cjs/function/extract_function.js +1 -2
- package/cjs/function/extract_function.js.map +1 -1
- package/cjs/function/is_function.d.ts +28 -5
- package/cjs/function/is_function.d.ts.map +1 -1
- package/cjs/function/is_not_function.d.ts +1 -1
- package/cjs/function/is_not_function.d.ts.map +1 -1
- package/cjs/function/is_not_strict_function.d.ts +15 -13
- package/cjs/function/is_not_strict_function.d.ts.map +1 -1
- package/cjs/function/is_strict_function.d.ts +22 -17
- package/cjs/function/is_strict_function.d.ts.map +1 -1
- package/cjs/functional/Maybe.d.ts +1 -1
- package/cjs/functional/Maybe.d.ts.map +1 -1
- package/cjs/functional/Maybe.js +2 -3
- package/cjs/functional/Maybe.js.map +1 -1
- package/cjs/functional/compose.d.ts.map +1 -1
- package/cjs/functional/compose.js +2 -5
- package/cjs/functional/compose.js.map +1 -1
- package/cjs/functional/context.js +1 -2
- package/cjs/functional/context.js.map +1 -1
- package/cjs/index.d.ts +21 -22
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/json.js +1 -1
- package/cjs/json.js.map +1 -1
- package/cjs/logical/logical.d.ts +35 -0
- package/cjs/logical/logical.d.ts.map +1 -0
- package/cjs/{predicates → logical}/logical.js.map +1 -1
- package/cjs/math/abs.d.ts +1 -1
- package/cjs/math/abs.d.ts.map +1 -1
- package/cjs/math/numeric_struct.d.ts.map +1 -1
- package/cjs/mix_types/box.d.ts +2 -2
- package/cjs/mix_types/box.d.ts.map +1 -1
- package/cjs/mix_types/is_any_or_never.d.ts +2 -3
- package/cjs/mix_types/is_any_or_never.d.ts.map +1 -1
- package/cjs/mix_types/merge.d.ts +18 -6
- package/cjs/mix_types/merge.d.ts.map +1 -1
- package/cjs/mix_types/merge.js +1 -2
- package/cjs/mix_types/merge.js.map +1 -1
- package/cjs/never/is_never.d.ts +16 -15
- package/cjs/never/is_never.d.ts.map +1 -1
- package/cjs/never/is_not_never.d.ts +16 -15
- package/cjs/never/is_not_never.d.ts.map +1 -1
- package/cjs/nodejs/isNodeError.js +1 -2
- package/cjs/nodejs/isNodeError.js.map +1 -1
- package/cjs/nominal/brand.js +1 -2
- package/cjs/nominal/brand.js.map +1 -1
- package/cjs/nominal/flavor.js +1 -2
- package/cjs/nominal/flavor.js.map +1 -1
- package/cjs/nominal/nominal_match.js +1 -2
- package/cjs/nominal/nominal_match.js.map +1 -1
- package/cjs/null/is_not_null.d.ts +15 -9
- package/cjs/null/is_not_null.d.ts.map +1 -1
- package/cjs/null/is_null.d.ts +15 -9
- package/cjs/null/is_null.d.ts.map +1 -1
- package/cjs/number/is_not_number.d.ts +20 -16
- package/cjs/number/is_not_number.d.ts.map +1 -1
- package/cjs/number/is_not_number_literal.d.ts +18 -13
- package/cjs/number/is_not_number_literal.d.ts.map +1 -1
- package/cjs/number/is_number.d.ts +20 -16
- package/cjs/number/is_number.d.ts.map +1 -1
- package/cjs/number/is_number_literal.d.ts +18 -13
- package/cjs/number/is_number_literal.d.ts.map +1 -1
- package/cjs/numeric/is_integer.d.ts +18 -12
- package/cjs/numeric/is_integer.d.ts.map +1 -1
- package/cjs/numeric/is_negative.d.ts +19 -13
- package/cjs/numeric/is_negative.d.ts.map +1 -1
- package/cjs/numeric/is_not_integer.d.ts +13 -7
- package/cjs/numeric/is_not_integer.d.ts.map +1 -1
- package/cjs/numeric/is_not_negative.d.ts +15 -9
- package/cjs/numeric/is_not_negative.d.ts.map +1 -1
- package/cjs/numeric/is_not_numeric.d.ts +1 -1
- package/cjs/numeric/is_not_numeric.d.ts.map +1 -1
- package/cjs/numeric/is_not_positive.d.ts +13 -7
- package/cjs/numeric/is_not_positive.d.ts.map +1 -1
- package/cjs/numeric/is_numeric.d.ts +28 -5
- package/cjs/numeric/is_numeric.d.ts.map +1 -1
- package/cjs/numeric/is_positive.d.ts +19 -13
- package/cjs/numeric/is_positive.d.ts.map +1 -1
- package/cjs/object/ANotB.d.ts +1 -1
- package/cjs/object/ANotB.d.ts.map +1 -1
- package/cjs/object/adjust_exact_optional_props.d.ts +6 -3
- package/cjs/object/adjust_exact_optional_props.d.ts.map +1 -1
- package/cjs/object/everyKey.js +1 -2
- package/cjs/object/everyKey.js.map +1 -1
- package/cjs/object/facade.js +1 -2
- package/cjs/object/facade.js.map +1 -1
- package/cjs/object/filterKey.js +1 -2
- package/cjs/object/filterKey.js.map +1 -1
- package/cjs/object/findKey.js +1 -2
- package/cjs/object/findKey.js.map +1 -1
- package/cjs/object/forEachKey.js +1 -2
- package/cjs/object/forEachKey.js.map +1 -1
- package/cjs/object/getField.js +1 -2
- package/cjs/object/getField.js.map +1 -1
- package/cjs/object/hasKey.js +1 -2
- package/cjs/object/hasKey.js.map +1 -1
- package/cjs/object/hasProperty.js +1 -2
- package/cjs/object/hasProperty.js.map +1 -1
- package/cjs/object/index.d.ts +6 -6
- package/cjs/object/index.d.ts.map +1 -1
- package/cjs/object/index.js.map +1 -1
- package/cjs/object/is_not_object.d.ts +23 -19
- package/cjs/object/is_not_object.d.ts.map +1 -1
- package/cjs/object/is_object.d.ts +23 -19
- package/cjs/object/is_object.d.ts.map +1 -1
- package/cjs/object/left_join.d.ts +1 -1
- package/cjs/object/left_join.d.ts.map +1 -1
- package/cjs/object/mapKey.js +1 -2
- package/cjs/object/mapKey.js.map +1 -1
- package/cjs/object/mapProperties.js +1 -2
- package/cjs/object/mapProperties.js.map +1 -1
- package/cjs/object/merge.d.ts +54 -48
- package/cjs/object/merge.d.ts.map +1 -1
- package/cjs/object/omit.js +1 -2
- package/cjs/object/omit.js.map +1 -1
- package/cjs/object/pick.js +1 -2
- package/cjs/object/pick.js.map +1 -1
- package/cjs/object/properties.d.ts +29 -4
- package/cjs/object/properties.d.ts.map +1 -1
- package/cjs/object/properties.js +1 -0
- package/cjs/object/properties.js.map +1 -1
- package/cjs/object/record.js +1 -2
- package/cjs/object/record.js.map +1 -1
- package/cjs/object/reduceKey.js +2 -2
- package/cjs/object/reduceKey.js.map +1 -1
- package/cjs/object/replaceProperty.js +1 -2
- package/cjs/object/replaceProperty.js.map +1 -1
- package/cjs/object/someKey.js +1 -2
- package/cjs/object/someKey.js.map +1 -1
- package/cjs/object/split.js +1 -2
- package/cjs/object/split.js.map +1 -1
- package/cjs/object/typeOverrideIncompatible.d.ts.map +1 -1
- package/cjs/object/typeOverrideIncompatible.js +1 -2
- package/cjs/object/typeOverrideIncompatible.js.map +1 -1
- package/cjs/predicates/CanAssign.js +1 -2
- package/cjs/predicates/CanAssign.js.map +1 -1
- package/cjs/predicates/assignable.d.ts +23 -25
- package/cjs/predicates/assignable.d.ts.map +1 -1
- package/cjs/predicates/index.d.ts +1 -1
- package/cjs/predicates/index.d.ts.map +1 -1
- package/cjs/predicates/index.js.map +1 -1
- package/cjs/predicates/not_assignable.d.ts +24 -26
- package/cjs/predicates/not_assignable.d.ts.map +1 -1
- package/cjs/promise/MaybePromise.js +2 -2
- package/cjs/promise/MaybePromise.js.map +1 -1
- package/cjs/promise/index.d.ts +1 -1
- package/cjs/promise/index.d.ts.map +1 -1
- package/cjs/promise/index.js +1 -1
- package/cjs/promise/index.js.map +1 -1
- package/cjs/promise/isPromise.js +2 -3
- package/cjs/promise/isPromise.js.map +1 -1
- package/cjs/promise/mapSeries.js +1 -2
- package/cjs/promise/mapSeries.js.map +1 -1
- package/cjs/string/$extract_manipulated_string.d.ts.map +1 -1
- package/cjs/string/_string_type.d.ts.map +1 -1
- package/cjs/string/is_not_string.d.ts +20 -17
- package/cjs/string/is_not_string.d.ts.map +1 -1
- package/cjs/string/is_not_string_literal.d.ts +25 -22
- package/cjs/string/is_not_string_literal.d.ts.map +1 -1
- package/cjs/string/is_not_template_literal.d.ts +18 -13
- package/cjs/string/is_not_template_literal.d.ts.map +1 -1
- package/cjs/string/is_string.d.ts +20 -16
- package/cjs/string/is_string.d.ts.map +1 -1
- package/cjs/string/is_string_literal.d.ts +25 -22
- package/cjs/string/is_string_literal.d.ts.map +1 -1
- package/cjs/string/is_template_literal.d.ts +18 -13
- package/cjs/string/is_template_literal.d.ts.map +1 -1
- package/cjs/symbol/is_not_symbol.d.ts +15 -9
- package/cjs/symbol/is_not_symbol.d.ts.map +1 -1
- package/cjs/symbol/is_symbol.d.ts +15 -9
- package/cjs/symbol/is_symbol.d.ts.map +1 -1
- package/cjs/testing/stub.d.ts +2 -3
- package/cjs/testing/stub.d.ts.map +1 -1
- package/cjs/testing/stub.js +1 -2
- package/cjs/testing/stub.js.map +1 -1
- package/cjs/testing/test_type.d.ts +1 -1
- package/cjs/testing/test_type.d.ts.map +1 -1
- package/cjs/tuple/drop.js +1 -2
- package/cjs/tuple/drop.js.map +1 -1
- package/cjs/tuple/is_not_tuple.d.ts +18 -13
- package/cjs/tuple/is_not_tuple.d.ts.map +1 -1
- package/cjs/tuple/is_tuple.d.ts +18 -13
- package/cjs/tuple/is_tuple.d.ts.map +1 -1
- package/cjs/tuple/tuple_plus.common_prop_keys.d.ts +1 -1
- package/cjs/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -1
- package/cjs/tuple/tuple_plus.drop_match.d.ts +1 -1
- package/cjs/tuple/tuple_plus.drop_match.d.ts.map +1 -1
- package/cjs/tuple/tuple_plus.find.d.ts +1 -1
- package/cjs/tuple/tuple_plus.find.d.ts.map +1 -1
- package/cjs/type-guard/is_type.d.ts +3 -3
- package/cjs/type-guard/is_type.d.ts.map +1 -1
- package/cjs/type-guard/is_type.js +1 -2
- package/cjs/type-guard/is_type.js.map +1 -1
- package/cjs/undefined/has_undefined.d.ts +4 -5
- package/cjs/undefined/has_undefined.d.ts.map +1 -1
- package/cjs/undefined/is_not_undefined.d.ts +15 -9
- package/cjs/undefined/is_not_undefined.d.ts.map +1 -1
- package/cjs/undefined/is_undefined.d.ts +15 -9
- package/cjs/undefined/is_undefined.d.ts.map +1 -1
- package/cjs/union/union_to_intersection.js +1 -2
- package/cjs/union/union_to_intersection.js.map +1 -1
- package/cjs/unknown/is_not_unknown.d.ts +15 -14
- package/cjs/unknown/is_not_unknown.d.ts.map +1 -1
- package/cjs/unknown/is_unknown.d.ts +15 -14
- package/cjs/unknown/is_unknown.d.ts.map +1 -1
- package/cjs/unknown/not_unknown_or.d.ts +1 -1
- package/cjs/unknown/not_unknown_or.d.ts.map +1 -1
- package/cjs/utils/Widen.d.ts +9 -2
- package/cjs/utils/Widen.d.ts.map +1 -1
- package/cjs/utils/as.d.ts +1 -1
- package/cjs/utils/as.d.ts.map +1 -1
- package/cjs/utils/as.js +3 -4
- package/cjs/utils/as.js.map +1 -1
- package/cjs/utils/excessive.d.ts +12 -0
- package/cjs/utils/excessive.d.ts.map +1 -0
- package/cjs/utils/excessive.js +3 -0
- package/cjs/utils/excessive.js.map +1 -0
- package/cjs/utils/inspect.js +1 -2
- package/cjs/utils/inspect.js.map +1 -1
- package/cjs/{type → utils}/no_infer.d.ts +9 -7
- package/cjs/utils/no_infer.d.ts.map +1 -0
- package/cjs/{type → utils}/no_infer.js.map +1 -1
- package/cjs/void/is_not_void.d.ts +17 -10
- package/cjs/void/is_not_void.d.ts.map +1 -1
- package/cjs/void/is_void.d.ts +17 -10
- package/cjs/void/is_void.d.ts.map +1 -1
- package/{cjs/type_plus → esm/$type}/$resolve_options.d.ts +2 -2
- package/esm/$type/$resolve_options.d.ts.map +1 -0
- package/esm/$type/$resolve_options.js.map +1 -0
- package/esm/$type/$type.d.ts +34 -0
- package/esm/$type/$type.d.ts.map +1 -0
- package/esm/{type_plus → $type}/$type.js.map +1 -1
- package/{cjs/type_plus → esm/$type}/branch/$branch.d.ts +3 -3
- package/esm/$type/branch/$branch.d.ts.map +1 -0
- package/esm/$type/branch/$branch.js.map +1 -0
- package/{cjs/type_plus → esm/$type}/branch/$input_options.d.ts +2 -1
- package/esm/$type/branch/$input_options.d.ts.map +1 -0
- package/esm/$type/branch/$input_options.js.map +1 -0
- package/esm/$type/branch/$resolve_branch.d.ts +22 -0
- package/esm/$type/branch/$resolve_branch.d.ts.map +1 -0
- package/esm/$type/branch/$resolve_branch.js.map +1 -0
- package/esm/$type/branch/$selection.d.ts +161 -0
- package/esm/$type/branch/$selection.d.ts.map +1 -0
- package/esm/$type/branch/$selection.js.map +1 -0
- package/esm/$type/distributive/$distributive.d.ts +27 -0
- package/esm/$type/distributive/$distributive.d.ts.map +1 -0
- package/esm/$type/distributive/$distributive.js.map +1 -0
- package/esm/$type/errors/$error.d.ts +23 -0
- package/esm/$type/errors/$error.d.ts.map +1 -0
- package/esm/{type_plus → $type/errors}/$error.js.map +1 -1
- package/{cjs/type_plus → esm/$type/errors}/$infer_error.d.ts +7 -6
- package/esm/$type/errors/$infer_error.d.ts.map +1 -0
- package/esm/$type/errors/$infer_error.js.map +1 -0
- package/{cjs/type → esm/$type/errors}/failed.d.ts +4 -0
- package/esm/$type/errors/failed.d.ts.map +1 -0
- package/esm/{type → $type/errors}/failed.js.map +1 -1
- package/esm/$type/exact/$exact.d.ts +27 -0
- package/esm/$type/exact/$exact.d.ts.map +1 -0
- package/esm/{type_plus/branch → $type/exact}/$exact.js.map +1 -1
- package/esm/$type/special/$any.d.ts +36 -0
- package/esm/$type/special/$any.d.ts.map +1 -0
- package/esm/$type/special/$any.js +2 -0
- package/esm/$type/special/$any.js.map +1 -0
- package/esm/$type/special/$never.d.ts +52 -0
- package/esm/$type/special/$never.d.ts.map +1 -0
- package/esm/$type/special/$never.js +2 -0
- package/esm/$type/special/$never.js.map +1 -0
- package/esm/$type/special/$special.d.ts +31 -0
- package/esm/$type/special/$special.d.ts.map +1 -0
- package/esm/$type/special/$special.js +2 -0
- package/esm/$type/special/$special.js.map +1 -0
- package/esm/$type/special/$unknown.d.ts +37 -0
- package/esm/$type/special/$unknown.d.ts.map +1 -0
- package/esm/$type/special/$unknown.js +2 -0
- package/esm/$type/special/$unknown.js.map +1 -0
- package/esm/$type/special/$void.d.ts +46 -0
- package/esm/$type/special/$void.d.ts.map +1 -0
- package/esm/$type/special/$void.js +2 -0
- package/esm/$type/special/$void.js.map +1 -0
- package/esm/$type/utils/$merge_options.d.ts +14 -0
- package/esm/$type/utils/$merge_options.d.ts.map +1 -0
- package/esm/$type/utils/$merge_options.js.map +1 -0
- package/esm/any/is_any.d.ts +23 -20
- package/esm/any/is_any.d.ts.map +1 -1
- package/esm/any/is_not_any.d.ts +15 -14
- package/esm/any/is_not_any.d.ts.map +1 -1
- package/esm/array/array.reverse.d.ts +1 -1
- package/esm/array/array.reverse.d.ts.map +1 -1
- package/esm/array/array.some.d.ts +1 -1
- package/esm/array/array.some.d.ts.map +1 -1
- package/esm/array/array_plus.common_prop_keys.d.ts +1 -1
- package/esm/array/array_plus.common_prop_keys.d.ts.map +1 -1
- package/esm/array/array_plus.filter.d.ts +2 -2
- package/esm/array/array_plus.filter.d.ts.map +1 -1
- package/esm/array/array_plus.find.d.ts +2 -2
- package/esm/array/array_plus.find.d.ts.map +1 -1
- package/esm/array/array_plus.index_at.d.ts +16 -10
- 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_readonly.d.ts +3 -3
- package/esm/array/array_plus.is_readonly.d.ts.map +1 -1
- package/esm/array/head.d.ts +3 -3
- package/esm/array/head.d.ts.map +1 -1
- package/esm/array/is_array.d.ts +23 -19
- package/esm/array/is_array.d.ts.map +1 -1
- package/esm/array/is_not_array.d.ts +23 -19
- package/esm/array/is_not_array.d.ts.map +1 -1
- package/esm/array/last.d.ts +5 -3
- package/esm/array/last.d.ts.map +1 -1
- package/esm/assertion/assert_type.d.ts +1 -1
- package/esm/assertion/assert_type.d.ts.map +1 -1
- package/esm/assertion/assert_type.js +0 -2
- package/esm/assertion/assert_type.js.map +1 -1
- package/esm/bigint/is_bigint.d.ts +20 -16
- package/esm/bigint/is_bigint.d.ts.map +1 -1
- package/esm/bigint/is_bigint_literal.d.ts +18 -13
- package/esm/bigint/is_bigint_literal.d.ts.map +1 -1
- package/esm/bigint/is_not_bigint.d.ts +20 -16
- package/esm/bigint/is_not_bigint.d.ts.map +1 -1
- package/esm/bigint/is_not_bigint_literal.d.ts +19 -13
- package/esm/bigint/is_not_bigint_literal.d.ts.map +1 -1
- package/esm/binary/_binary.d.ts +2 -1
- package/esm/binary/_binary.d.ts.map +1 -1
- package/esm/binary/_binary.js +2 -1
- package/esm/binary/_binary.js.map +1 -1
- package/esm/binary/bit.d.ts +26 -0
- package/esm/binary/bit.d.ts.map +1 -0
- package/esm/binary/bit.js +2 -0
- package/esm/binary/bit.js.map +1 -0
- package/esm/boolean/is_boolean.d.ts +20 -16
- package/esm/boolean/is_boolean.d.ts.map +1 -1
- package/esm/boolean/is_false.d.ts +15 -9
- package/esm/boolean/is_false.d.ts.map +1 -1
- package/esm/boolean/is_not_boolean.d.ts +21 -16
- package/esm/boolean/is_not_boolean.d.ts.map +1 -1
- package/esm/boolean/is_not_false.d.ts +16 -9
- package/esm/boolean/is_not_false.d.ts.map +1 -1
- package/esm/boolean/is_not_true.d.ts +15 -9
- package/esm/boolean/is_not_true.d.ts.map +1 -1
- package/esm/boolean/is_true.d.ts +15 -9
- package/esm/boolean/is_true.d.ts.map +1 -1
- package/esm/equal/equal.d.ts +189 -74
- package/esm/equal/equal.d.ts.map +1 -1
- package/esm/equal/identity_equal.d.ts +5 -1
- package/esm/equal/identity_equal.d.ts.map +1 -1
- package/esm/equal/is_equal.d.ts +102 -0
- package/esm/equal/is_equal.d.ts.map +1 -0
- package/esm/equal/is_equal.js +2 -0
- package/esm/equal/is_equal.js.map +1 -0
- package/esm/function/extract_function.d.ts.map +1 -1
- package/esm/function/is_function.d.ts +28 -5
- package/esm/function/is_function.d.ts.map +1 -1
- package/esm/function/is_not_function.d.ts +1 -1
- package/esm/function/is_not_function.d.ts.map +1 -1
- package/esm/function/is_not_strict_function.d.ts +15 -13
- package/esm/function/is_not_strict_function.d.ts.map +1 -1
- package/esm/function/is_strict_function.d.ts +22 -17
- package/esm/function/is_strict_function.d.ts.map +1 -1
- package/esm/functional/Maybe.d.ts +1 -1
- package/esm/functional/Maybe.d.ts.map +1 -1
- package/esm/functional/compose.d.ts.map +1 -1
- package/esm/functional/compose.js +1 -3
- package/esm/functional/compose.js.map +1 -1
- package/esm/index.d.ts +21 -22
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/json.js +1 -1
- package/esm/json.js.map +1 -1
- package/esm/logical/logical.d.ts +35 -0
- package/esm/logical/logical.d.ts.map +1 -0
- package/esm/{predicates → logical}/logical.js.map +1 -1
- package/esm/math/abs.d.ts +1 -1
- package/esm/math/abs.d.ts.map +1 -1
- package/esm/math/numeric_struct.d.ts.map +1 -1
- package/esm/mix_types/box.d.ts +2 -2
- package/esm/mix_types/box.d.ts.map +1 -1
- package/esm/mix_types/is_any_or_never.d.ts +2 -3
- package/esm/mix_types/is_any_or_never.d.ts.map +1 -1
- package/esm/mix_types/merge.d.ts +18 -6
- package/esm/mix_types/merge.d.ts.map +1 -1
- package/esm/mix_types/merge.js.map +1 -1
- package/esm/never/is_never.d.ts +16 -15
- package/esm/never/is_never.d.ts.map +1 -1
- package/esm/never/is_not_never.d.ts +16 -15
- package/esm/never/is_not_never.d.ts.map +1 -1
- package/esm/null/is_not_null.d.ts +15 -9
- package/esm/null/is_not_null.d.ts.map +1 -1
- package/esm/null/is_null.d.ts +15 -9
- package/esm/null/is_null.d.ts.map +1 -1
- package/esm/number/is_not_number.d.ts +20 -16
- package/esm/number/is_not_number.d.ts.map +1 -1
- package/esm/number/is_not_number_literal.d.ts +18 -13
- package/esm/number/is_not_number_literal.d.ts.map +1 -1
- package/esm/number/is_number.d.ts +20 -16
- package/esm/number/is_number.d.ts.map +1 -1
- package/esm/number/is_number_literal.d.ts +18 -13
- package/esm/number/is_number_literal.d.ts.map +1 -1
- package/esm/numeric/is_integer.d.ts +18 -12
- package/esm/numeric/is_integer.d.ts.map +1 -1
- package/esm/numeric/is_negative.d.ts +19 -13
- package/esm/numeric/is_negative.d.ts.map +1 -1
- package/esm/numeric/is_not_integer.d.ts +13 -7
- package/esm/numeric/is_not_integer.d.ts.map +1 -1
- package/esm/numeric/is_not_negative.d.ts +15 -9
- package/esm/numeric/is_not_negative.d.ts.map +1 -1
- package/esm/numeric/is_not_numeric.d.ts +1 -1
- package/esm/numeric/is_not_numeric.d.ts.map +1 -1
- package/esm/numeric/is_not_positive.d.ts +13 -7
- package/esm/numeric/is_not_positive.d.ts.map +1 -1
- package/esm/numeric/is_numeric.d.ts +28 -5
- package/esm/numeric/is_numeric.d.ts.map +1 -1
- package/esm/numeric/is_positive.d.ts +19 -13
- package/esm/numeric/is_positive.d.ts.map +1 -1
- package/esm/object/ANotB.d.ts +1 -1
- package/esm/object/ANotB.d.ts.map +1 -1
- package/esm/object/adjust_exact_optional_props.d.ts +6 -3
- package/esm/object/adjust_exact_optional_props.d.ts.map +1 -1
- package/esm/object/index.d.ts +6 -6
- package/esm/object/index.d.ts.map +1 -1
- package/esm/object/index.js.map +1 -1
- package/esm/object/is_not_object.d.ts +23 -19
- package/esm/object/is_not_object.d.ts.map +1 -1
- package/esm/object/is_object.d.ts +23 -19
- package/esm/object/is_object.d.ts.map +1 -1
- package/esm/object/left_join.d.ts +1 -1
- package/esm/object/left_join.d.ts.map +1 -1
- package/esm/object/merge.d.ts +54 -48
- package/esm/object/merge.d.ts.map +1 -1
- package/esm/object/properties.d.ts +29 -4
- package/esm/object/properties.d.ts.map +1 -1
- package/esm/object/properties.js +1 -0
- package/esm/object/properties.js.map +1 -1
- package/esm/object/typeOverrideIncompatible.d.ts.map +1 -1
- package/esm/predicates/assignable.d.ts +23 -25
- package/esm/predicates/assignable.d.ts.map +1 -1
- package/esm/predicates/index.d.ts +1 -1
- package/esm/predicates/index.d.ts.map +1 -1
- package/esm/predicates/index.js.map +1 -1
- package/esm/predicates/not_assignable.d.ts +24 -26
- package/esm/predicates/not_assignable.d.ts.map +1 -1
- package/esm/promise/index.d.ts +1 -1
- package/esm/promise/index.d.ts.map +1 -1
- package/esm/promise/index.js +1 -1
- package/esm/promise/index.js.map +1 -1
- package/esm/promise/isPromise.js +1 -1
- package/esm/promise/isPromise.js.map +1 -1
- 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 +20 -17
- package/esm/string/is_not_string.d.ts.map +1 -1
- package/esm/string/is_not_string_literal.d.ts +25 -22
- package/esm/string/is_not_string_literal.d.ts.map +1 -1
- package/esm/string/is_not_template_literal.d.ts +18 -13
- package/esm/string/is_not_template_literal.d.ts.map +1 -1
- package/esm/string/is_string.d.ts +20 -16
- package/esm/string/is_string.d.ts.map +1 -1
- package/esm/string/is_string_literal.d.ts +25 -22
- package/esm/string/is_string_literal.d.ts.map +1 -1
- package/esm/string/is_template_literal.d.ts +18 -13
- package/esm/string/is_template_literal.d.ts.map +1 -1
- package/esm/symbol/is_not_symbol.d.ts +15 -9
- package/esm/symbol/is_not_symbol.d.ts.map +1 -1
- package/esm/symbol/is_symbol.d.ts +15 -9
- package/esm/symbol/is_symbol.d.ts.map +1 -1
- package/esm/testing/stub.d.ts +2 -3
- package/esm/testing/stub.d.ts.map +1 -1
- package/esm/testing/stub.js.map +1 -1
- package/esm/testing/test_type.d.ts +1 -1
- package/esm/testing/test_type.d.ts.map +1 -1
- package/esm/tuple/is_not_tuple.d.ts +18 -13
- package/esm/tuple/is_not_tuple.d.ts.map +1 -1
- package/esm/tuple/is_tuple.d.ts +18 -13
- package/esm/tuple/is_tuple.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 +1 -1
- package/esm/tuple/tuple_plus.drop_match.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.find.d.ts +1 -1
- package/esm/tuple/tuple_plus.find.d.ts.map +1 -1
- package/esm/type-guard/is_type.d.ts +3 -3
- package/esm/type-guard/is_type.d.ts.map +1 -1
- package/esm/undefined/has_undefined.d.ts +4 -5
- package/esm/undefined/has_undefined.d.ts.map +1 -1
- package/esm/undefined/is_not_undefined.d.ts +15 -9
- package/esm/undefined/is_not_undefined.d.ts.map +1 -1
- package/esm/undefined/is_undefined.d.ts +15 -9
- package/esm/undefined/is_undefined.d.ts.map +1 -1
- package/esm/unknown/is_not_unknown.d.ts +15 -14
- package/esm/unknown/is_not_unknown.d.ts.map +1 -1
- package/esm/unknown/is_unknown.d.ts +15 -14
- package/esm/unknown/is_unknown.d.ts.map +1 -1
- package/esm/unknown/not_unknown_or.d.ts +1 -1
- package/esm/unknown/not_unknown_or.d.ts.map +1 -1
- package/esm/utils/Widen.d.ts +9 -2
- package/esm/utils/Widen.d.ts.map +1 -1
- package/esm/utils/as.d.ts +1 -1
- package/esm/utils/as.d.ts.map +1 -1
- package/esm/utils/excessive.d.ts +12 -0
- package/esm/utils/excessive.d.ts.map +1 -0
- package/esm/utils/excessive.js +2 -0
- package/esm/utils/excessive.js.map +1 -0
- package/esm/{type → utils}/no_infer.d.ts +9 -7
- package/esm/utils/no_infer.d.ts.map +1 -0
- package/esm/{type → utils}/no_infer.js.map +1 -1
- package/esm/void/is_not_void.d.ts +17 -10
- package/esm/void/is_not_void.d.ts.map +1 -1
- package/esm/void/is_void.d.ts +17 -10
- package/esm/void/is_void.d.ts.map +1 -1
- package/package.json +18 -22
- package/readme.md +74 -74
- package/src/{type_plus → $type}/$resolve_options.ts +4 -2
- package/src/$type/$type.ts +37 -0
- package/src/{type_plus → $type}/branch/$branch.ts +4 -2
- package/src/{type_plus → $type}/branch/$input_options.ts +2 -1
- package/src/$type/branch/$resolve_branch.ts +46 -0
- package/src/$type/branch/$selection.ts +170 -0
- package/src/$type/branch/readme.md +78 -0
- package/src/$type/distributive/$distributive.ts +34 -0
- package/src/$type/distributive/readme.md +26 -0
- package/src/$type/errors/$error.ts +20 -0
- package/src/{type_plus → $type/errors}/$infer_error.ts +7 -8
- package/src/{type → $type/errors}/failed.ts +4 -0
- package/src/$type/errors/readme.md +60 -0
- package/src/$type/exact/$exact.ts +34 -0
- package/src/$type/exact/readme.md +27 -0
- package/src/$type/readme.md +23 -0
- package/src/$type/special/$any.ts +34 -0
- package/src/$type/special/$never.ts +51 -0
- package/src/$type/special/$special.ts +40 -0
- package/src/$type/special/$unknown.ts +35 -0
- package/src/$type/special/$void.ts +44 -0
- package/src/$type/special/readme.md +51 -0
- package/src/$type/utils/$merge_options.ts +11 -0
- package/src/$type/utils/readme.md +10 -0
- package/src/any/is_any.ts +23 -20
- package/src/any/is_not_any.ts +15 -14
- package/src/any/readme.md +30 -19
- package/src/array/array.reverse.ts +2 -5
- package/src/array/array.some.ts +1 -1
- package/src/array/array_plus.common_prop_keys.ts +1 -1
- package/src/array/array_plus.filter.ts +2 -2
- package/src/array/array_plus.find.ts +2 -2
- package/src/array/array_plus.index_at.ts +23 -29
- package/src/array/array_plus.is_readonly.ts +3 -3
- package/src/array/head.ts +3 -3
- package/src/array/is_array.ts +30 -23
- package/src/array/is_not_array.ts +30 -23
- package/src/array/last.ts +6 -14
- package/src/array/readme.md +3 -3
- package/src/assertion/assert_type.ts +1 -3
- package/src/bigint/is_bigint.ts +28 -21
- package/src/bigint/is_bigint_literal.ts +25 -17
- package/src/bigint/is_not_bigint.ts +27 -20
- package/src/bigint/is_not_bigint_literal.ts +26 -17
- package/src/bigint/readme.md +25 -8
- package/src/binary/_binary.ts +2 -1
- package/src/binary/bit.ts +29 -0
- package/src/binary/readme.md +11 -0
- package/src/boolean/is_boolean.ts +30 -23
- package/src/boolean/is_false.ts +18 -9
- package/src/boolean/is_not_boolean.ts +30 -22
- package/src/boolean/is_not_false.ts +19 -9
- package/src/boolean/is_not_true.ts +18 -9
- package/src/boolean/is_true.ts +18 -9
- package/src/equal/equal.ts +307 -89
- package/src/equal/identity_equal.ts +3 -7
- package/src/equal/is_equal.ts +150 -0
- package/src/equal/readme.md +20 -1
- package/src/function/is_function.ts +37 -5
- package/src/function/is_not_function.ts +1 -1
- package/src/function/is_not_strict_function.ts +16 -14
- package/src/function/is_strict_function.ts +29 -21
- package/src/functional/Maybe.ts +1 -1
- package/src/functional/compose.ts +1 -3
- package/src/index.ts +21 -22
- package/src/json.ts +1 -1
- package/src/logical/logical.ts +52 -0
- package/src/logical/readme.md +53 -0
- package/src/math/abs.ts +1 -1
- package/src/math/numeric_struct.ts +6 -6
- package/src/mix_types/box.ts +2 -2
- package/src/mix_types/is_any_or_never.ts +2 -3
- package/src/mix_types/merge.ts +22 -17
- package/src/never/is_never.ts +16 -15
- package/src/never/is_not_never.ts +16 -15
- package/src/null/is_not_null.ts +18 -9
- package/src/null/is_null.ts +18 -9
- package/src/number/is_not_number.ts +27 -20
- package/src/number/is_not_number_literal.ts +25 -17
- package/src/number/is_number.ts +27 -20
- package/src/number/is_number_literal.ts +25 -17
- package/src/numeric/is_integer.ts +29 -30
- package/src/numeric/is_negative.ts +29 -20
- package/src/numeric/is_not_integer.ts +19 -10
- package/src/numeric/is_not_negative.ts +25 -13
- package/src/numeric/is_not_numeric.ts +1 -1
- package/src/numeric/is_not_positive.ts +19 -9
- package/src/numeric/is_numeric.ts +37 -5
- package/src/numeric/is_positive.ts +29 -21
- package/src/object/ANotB.ts +1 -1
- package/src/object/adjust_exact_optional_props.ts +10 -1
- package/src/object/index.ts +6 -6
- package/src/object/is_not_object.ts +29 -22
- package/src/object/is_object.ts +29 -22
- package/src/object/left_join.ts +1 -1
- package/src/object/merge.ts +53 -49
- package/src/object/properties.ts +35 -2
- package/src/predicates/assignable.ts +23 -25
- package/src/predicates/index.ts +1 -1
- package/src/predicates/not_assignable.ts +24 -26
- package/src/promise/index.ts +1 -1
- package/src/promise/isPromise.ts +1 -1
- package/src/string/$extract_manipulated_string.ts +32 -28
- package/src/string/_string_type.ts +9 -8
- package/src/string/is_not_string.ts +29 -23
- package/src/string/is_not_string_literal.ts +36 -30
- package/src/string/is_not_template_literal.ts +24 -16
- package/src/string/is_string.ts +27 -20
- package/src/string/is_string_literal.ts +36 -30
- package/src/string/is_template_literal.ts +24 -16
- package/src/symbol/is_not_symbol.ts +18 -9
- package/src/symbol/is_symbol.ts +18 -9
- package/src/testing/stub.ts +0 -1
- package/src/testing/test_type.ts +1 -1
- package/src/tuple/is_not_tuple.ts +26 -17
- package/src/tuple/is_tuple.ts +25 -17
- package/src/tuple/tuple_plus.common_prop_keys.ts +1 -1
- package/src/tuple/tuple_plus.drop_match.ts +1 -1
- package/src/tuple/tuple_plus.find.ts +1 -1
- package/src/type-guard/is_type.ts +1 -1
- package/src/undefined/has_undefined.ts +5 -6
- package/src/undefined/is_not_undefined.ts +18 -9
- package/src/undefined/is_undefined.ts +18 -9
- package/src/unknown/is_not_unknown.ts +15 -14
- package/src/unknown/is_unknown.ts +15 -14
- package/src/unknown/not_unknown_or.ts +1 -1
- package/src/utils/Widen.ts +9 -2
- package/src/utils/excessive.ts +11 -0
- package/src/{type → utils}/no_infer.ts +13 -7
- package/src/utils/readme.md +17 -0
- package/src/void/is_not_void.ts +20 -10
- package/src/void/is_void.ts +20 -10
- package/cjs/any/any.d.ts +0 -49
- package/cjs/any/any.d.ts.map +0 -1
- package/cjs/any/any.js.map +0 -1
- package/cjs/binary/Bit.d.ts +0 -6
- package/cjs/binary/Bit.d.ts.map +0 -1
- package/cjs/binary/Bit.js.map +0 -1
- package/cjs/binary/index.d.ts +0 -3
- package/cjs/binary/index.d.ts.map +0 -1
- package/cjs/binary/index.js +0 -6
- package/cjs/binary/index.js.map +0 -1
- package/cjs/never/never.d.ts +0 -75
- package/cjs/never/never.d.ts.map +0 -1
- package/cjs/never/never.js.map +0 -1
- package/cjs/predicates/logical.d.ts +0 -5
- package/cjs/predicates/logical.d.ts.map +0 -1
- package/cjs/type/failed.d.ts.map +0 -1
- package/cjs/type/no_infer.d.ts.map +0 -1
- package/cjs/type_plus/$equality.d.ts +0 -12
- package/cjs/type_plus/$equality.d.ts.map +0 -1
- package/cjs/type_plus/$equality.js +0 -3
- package/cjs/type_plus/$equality.js.map +0 -1
- package/cjs/type_plus/$error.d.ts +0 -8
- package/cjs/type_plus/$error.d.ts.map +0 -1
- package/cjs/type_plus/$infer_error.d.ts.map +0 -1
- package/cjs/type_plus/$infer_error.js.map +0 -1
- package/cjs/type_plus/$merge_options.d.ts +0 -11
- package/cjs/type_plus/$merge_options.d.ts.map +0 -1
- package/cjs/type_plus/$merge_options.js.map +0 -1
- package/cjs/type_plus/$resolve_options.d.ts.map +0 -1
- package/cjs/type_plus/$resolve_options.js.map +0 -1
- package/cjs/type_plus/$special_type.d.ts +0 -19
- package/cjs/type_plus/$special_type.d.ts.map +0 -1
- package/cjs/type_plus/$special_type.js +0 -3
- package/cjs/type_plus/$special_type.js.map +0 -1
- package/cjs/type_plus/$type.d.ts +0 -11
- package/cjs/type_plus/$type.d.ts.map +0 -1
- package/cjs/type_plus/branch/$branch.d.ts.map +0 -1
- package/cjs/type_plus/branch/$branch.js.map +0 -1
- package/cjs/type_plus/branch/$distributive.d.ts +0 -19
- package/cjs/type_plus/branch/$distributive.d.ts.map +0 -1
- package/cjs/type_plus/branch/$distributive.js.map +0 -1
- package/cjs/type_plus/branch/$exact.d.ts +0 -21
- package/cjs/type_plus/branch/$exact.d.ts.map +0 -1
- package/cjs/type_plus/branch/$input_options.d.ts.map +0 -1
- package/cjs/type_plus/branch/$input_options.js.map +0 -1
- package/cjs/type_plus/branch/$is_distributive.d.ts +0 -6
- package/cjs/type_plus/branch/$is_distributive.d.ts.map +0 -1
- package/cjs/type_plus/branch/$is_distributive.js +0 -3
- package/cjs/type_plus/branch/$is_distributive.js.map +0 -1
- package/cjs/type_plus/branch/$override.d.ts +0 -21
- package/cjs/type_plus/branch/$override.d.ts.map +0 -1
- package/cjs/type_plus/branch/$override.js +0 -3
- package/cjs/type_plus/branch/$override.js.map +0 -1
- package/cjs/type_plus/branch/$resolve_branch.d.ts +0 -29
- package/cjs/type_plus/branch/$resolve_branch.d.ts.map +0 -1
- package/cjs/type_plus/branch/$resolve_branch.js.map +0 -1
- package/cjs/type_plus/branch/$select.d.ts +0 -77
- package/cjs/type_plus/branch/$select.d.ts.map +0 -1
- package/cjs/type_plus/branch/$select.js +0 -3
- package/cjs/type_plus/branch/$select.js.map +0 -1
- package/cjs/type_plus/branch/$select_invert.d.ts +0 -75
- package/cjs/type_plus/branch/$select_invert.d.ts.map +0 -1
- package/cjs/type_plus/branch/$select_invert.js +0 -3
- package/cjs/type_plus/branch/$select_invert.js.map +0 -1
- package/cjs/type_plus/branch/$select_invert_strict.d.ts +0 -75
- package/cjs/type_plus/branch/$select_invert_strict.d.ts.map +0 -1
- package/cjs/type_plus/branch/$select_invert_strict.js +0 -3
- package/cjs/type_plus/branch/$select_invert_strict.js.map +0 -1
- package/cjs/type_plus/branch/$select_strict.d.ts +0 -76
- package/cjs/type_plus/branch/$select_strict.d.ts.map +0 -1
- package/cjs/type_plus/branch/$select_strict.js +0 -3
- package/cjs/type_plus/branch/$select_strict.js.map +0 -1
- package/cjs/type_plus/branch/$selection.d.ts +0 -127
- package/cjs/type_plus/branch/$selection.d.ts.map +0 -1
- package/cjs/type_plus/branch/$selection.js.map +0 -1
- package/cjs/type_plus/branch/$selection_options.d.ts +0 -37
- package/cjs/type_plus/branch/$selection_options.d.ts.map +0 -1
- package/cjs/type_plus/branch/$selection_options.js +0 -3
- package/cjs/type_plus/branch/$selection_options.js.map +0 -1
- package/cjs/unknown/unknown.d.ts +0 -55
- package/cjs/unknown/unknown.d.ts.map +0 -1
- package/cjs/unknown/unknown.js +0 -3
- package/cjs/unknown/unknown.js.map +0 -1
- package/esm/any/any.d.ts +0 -49
- package/esm/any/any.d.ts.map +0 -1
- package/esm/any/any.js +0 -2
- package/esm/any/any.js.map +0 -1
- package/esm/binary/Bit.d.ts +0 -6
- package/esm/binary/Bit.d.ts.map +0 -1
- package/esm/binary/Bit.js +0 -2
- package/esm/binary/Bit.js.map +0 -1
- package/esm/binary/index.d.ts +0 -3
- package/esm/binary/index.d.ts.map +0 -1
- package/esm/binary/index.js +0 -3
- package/esm/binary/index.js.map +0 -1
- package/esm/never/never.d.ts +0 -75
- package/esm/never/never.d.ts.map +0 -1
- package/esm/never/never.js +0 -2
- package/esm/never/never.js.map +0 -1
- package/esm/predicates/logical.d.ts +0 -5
- package/esm/predicates/logical.d.ts.map +0 -1
- package/esm/type/failed.d.ts.map +0 -1
- package/esm/type/no_infer.d.ts.map +0 -1
- package/esm/type_plus/$equality.d.ts +0 -12
- package/esm/type_plus/$equality.d.ts.map +0 -1
- package/esm/type_plus/$equality.js +0 -2
- package/esm/type_plus/$equality.js.map +0 -1
- package/esm/type_plus/$error.d.ts +0 -8
- package/esm/type_plus/$error.d.ts.map +0 -1
- package/esm/type_plus/$infer_error.d.ts.map +0 -1
- package/esm/type_plus/$infer_error.js.map +0 -1
- package/esm/type_plus/$merge_options.d.ts +0 -11
- package/esm/type_plus/$merge_options.d.ts.map +0 -1
- package/esm/type_plus/$merge_options.js.map +0 -1
- package/esm/type_plus/$resolve_options.d.ts.map +0 -1
- package/esm/type_plus/$resolve_options.js.map +0 -1
- package/esm/type_plus/$special_type.d.ts +0 -19
- package/esm/type_plus/$special_type.d.ts.map +0 -1
- package/esm/type_plus/$special_type.js +0 -2
- package/esm/type_plus/$special_type.js.map +0 -1
- package/esm/type_plus/$type.d.ts +0 -11
- package/esm/type_plus/$type.d.ts.map +0 -1
- package/esm/type_plus/branch/$branch.d.ts.map +0 -1
- package/esm/type_plus/branch/$branch.js.map +0 -1
- package/esm/type_plus/branch/$distributive.d.ts +0 -19
- package/esm/type_plus/branch/$distributive.d.ts.map +0 -1
- package/esm/type_plus/branch/$distributive.js.map +0 -1
- package/esm/type_plus/branch/$exact.d.ts +0 -21
- package/esm/type_plus/branch/$exact.d.ts.map +0 -1
- package/esm/type_plus/branch/$input_options.d.ts.map +0 -1
- package/esm/type_plus/branch/$input_options.js.map +0 -1
- package/esm/type_plus/branch/$is_distributive.d.ts +0 -6
- package/esm/type_plus/branch/$is_distributive.d.ts.map +0 -1
- package/esm/type_plus/branch/$is_distributive.js +0 -2
- package/esm/type_plus/branch/$is_distributive.js.map +0 -1
- package/esm/type_plus/branch/$override.d.ts +0 -21
- package/esm/type_plus/branch/$override.d.ts.map +0 -1
- package/esm/type_plus/branch/$override.js +0 -2
- package/esm/type_plus/branch/$override.js.map +0 -1
- package/esm/type_plus/branch/$resolve_branch.d.ts +0 -29
- package/esm/type_plus/branch/$resolve_branch.d.ts.map +0 -1
- package/esm/type_plus/branch/$resolve_branch.js.map +0 -1
- package/esm/type_plus/branch/$select.d.ts +0 -77
- package/esm/type_plus/branch/$select.d.ts.map +0 -1
- package/esm/type_plus/branch/$select.js +0 -2
- package/esm/type_plus/branch/$select.js.map +0 -1
- package/esm/type_plus/branch/$select_invert.d.ts +0 -75
- package/esm/type_plus/branch/$select_invert.d.ts.map +0 -1
- package/esm/type_plus/branch/$select_invert.js +0 -2
- package/esm/type_plus/branch/$select_invert.js.map +0 -1
- package/esm/type_plus/branch/$select_invert_strict.d.ts +0 -75
- package/esm/type_plus/branch/$select_invert_strict.d.ts.map +0 -1
- package/esm/type_plus/branch/$select_invert_strict.js +0 -2
- package/esm/type_plus/branch/$select_invert_strict.js.map +0 -1
- package/esm/type_plus/branch/$select_strict.d.ts +0 -76
- package/esm/type_plus/branch/$select_strict.d.ts.map +0 -1
- package/esm/type_plus/branch/$select_strict.js +0 -2
- package/esm/type_plus/branch/$select_strict.js.map +0 -1
- package/esm/type_plus/branch/$selection.d.ts +0 -127
- package/esm/type_plus/branch/$selection.d.ts.map +0 -1
- package/esm/type_plus/branch/$selection.js.map +0 -1
- package/esm/type_plus/branch/$selection_options.d.ts +0 -37
- package/esm/type_plus/branch/$selection_options.d.ts.map +0 -1
- package/esm/type_plus/branch/$selection_options.js +0 -2
- package/esm/type_plus/branch/$selection_options.js.map +0 -1
- package/esm/unknown/unknown.d.ts +0 -55
- package/esm/unknown/unknown.d.ts.map +0 -1
- package/esm/unknown/unknown.js +0 -2
- package/esm/unknown/unknown.js.map +0 -1
- package/src/any/any.ts +0 -46
- package/src/binary/Bit.ts +0 -6
- package/src/binary/index.ts +0 -2
- package/src/never/never.ts +0 -78
- package/src/predicates/logical.ts +0 -19
- package/src/type/readme.md +0 -36
- package/src/type_plus/$equality.ts +0 -12
- package/src/type_plus/$error.ts +0 -8
- package/src/type_plus/$merge_options.ts +0 -8
- package/src/type_plus/$special_type.ts +0 -26
- package/src/type_plus/$type.ts +0 -10
- package/src/type_plus/branch/$distributive.ts +0 -19
- package/src/type_plus/branch/$exact.ts +0 -28
- package/src/type_plus/branch/$is_distributive.ts +0 -15
- package/src/type_plus/branch/$override.ts +0 -22
- package/src/type_plus/branch/$resolve_branch.ts +0 -71
- package/src/type_plus/branch/$select.ts +0 -89
- package/src/type_plus/branch/$select_invert.ts +0 -83
- package/src/type_plus/branch/$select_invert_strict.ts +0 -83
- package/src/type_plus/branch/$select_strict.ts +0 -88
- package/src/type_plus/branch/$selection.ts +0 -134
- package/src/type_plus/branch/$selection_options.ts +0 -36
- package/src/type_plus/readme.md +0 -25
- package/src/unknown/unknown.ts +0 -57
- /package/cjs/{type_plus → $type}/$resolve_options.js +0 -0
- /package/cjs/{type_plus → $type}/$type.js +0 -0
- /package/cjs/{type_plus → $type}/branch/$branch.js +0 -0
- /package/cjs/{type_plus → $type}/branch/$input_options.js +0 -0
- /package/cjs/{type_plus → $type}/branch/$resolve_branch.js +0 -0
- /package/cjs/{type_plus → $type}/branch/$selection.js +0 -0
- /package/cjs/{type_plus/branch → $type/distributive}/$distributive.js +0 -0
- /package/cjs/{type_plus → $type/errors}/$error.js +0 -0
- /package/cjs/{type_plus → $type/errors}/$infer_error.js +0 -0
- /package/cjs/{type → $type/errors}/failed.js +0 -0
- /package/cjs/{type_plus/branch → $type/exact}/$exact.js +0 -0
- /package/cjs/{type_plus → $type/utils}/$merge_options.js +0 -0
- /package/cjs/{predicates → logical}/logical.js +0 -0
- /package/cjs/{type → utils}/no_infer.js +0 -0
- /package/esm/{type_plus → $type}/$resolve_options.js +0 -0
- /package/esm/{type_plus → $type}/$type.js +0 -0
- /package/esm/{type_plus → $type}/branch/$branch.js +0 -0
- /package/esm/{type_plus → $type}/branch/$input_options.js +0 -0
- /package/esm/{type_plus → $type}/branch/$resolve_branch.js +0 -0
- /package/esm/{type_plus → $type}/branch/$selection.js +0 -0
- /package/esm/{type_plus/branch → $type/distributive}/$distributive.js +0 -0
- /package/esm/{type_plus → $type/errors}/$error.js +0 -0
- /package/esm/{type_plus → $type/errors}/$infer_error.js +0 -0
- /package/esm/{type → $type/errors}/failed.js +0 -0
- /package/esm/{type_plus/branch → $type/exact}/$exact.js +0 -0
- /package/esm/{type_plus → $type/utils}/$merge_options.js +0 -0
- /package/esm/{predicates → logical}/logical.js +0 -0
- /package/esm/{type → utils}/no_infer.js +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { $Type } from '../$type.js'
|
|
2
|
+
import type { $InferError } from '../errors/$infer_error.js'
|
|
3
|
+
import type { $Branch } from './$branch.js'
|
|
4
|
+
import type { $Else, $Then } from './$selection.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Resolve option value based on list of branches.
|
|
8
|
+
* It returns the first branch value that is specified in the option,
|
|
9
|
+
* otherwise will return the default value.
|
|
10
|
+
*
|
|
11
|
+
* Since this is an type utility,
|
|
12
|
+
* it does not perform extensive validations.
|
|
13
|
+
* Please check the description of each input below for information.
|
|
14
|
+
*
|
|
15
|
+
* @typeparam $O The input option. It should be a Record, not any, unknown, or never
|
|
16
|
+
* @typeparam $B Tuple of branches with at least one entry.
|
|
17
|
+
* @typeparam D Default value to return if no branch is found.
|
|
18
|
+
*/
|
|
19
|
+
export type $ResolveBranch<
|
|
20
|
+
$O extends Record<string, any>,
|
|
21
|
+
$Branches extends Array<$Branch<any> | unknown>,
|
|
22
|
+
D = unknown,
|
|
23
|
+
> = $Branches extends [infer B]
|
|
24
|
+
? _Last<$O, B, D>
|
|
25
|
+
: $Branches extends [infer B, ...infer Rest extends Array<$Branch<any> | unknown>]
|
|
26
|
+
? _<$O, B, $ResolveBranch<$O, Rest, D>>
|
|
27
|
+
: $InferError<'$Branches must have at least one entry'>
|
|
28
|
+
|
|
29
|
+
type _<$O extends Record<string, any>, $B, D> = $B extends $Branch<any>
|
|
30
|
+
? $B[$Type.$ValueKey] extends keyof $O
|
|
31
|
+
? $O[$B[$Type.$ValueKey]]
|
|
32
|
+
: D
|
|
33
|
+
: D
|
|
34
|
+
type _Last<$O extends Record<string, any>, $B, D> = $B extends $Then
|
|
35
|
+
? '$then' extends keyof $O
|
|
36
|
+
? $O['$then']
|
|
37
|
+
: $O['selection'] extends 'filter'
|
|
38
|
+
? D
|
|
39
|
+
: true
|
|
40
|
+
: $B extends $Else
|
|
41
|
+
? '$else' extends keyof $O
|
|
42
|
+
? $O['$else']
|
|
43
|
+
: $O['selection'] extends 'filter'
|
|
44
|
+
? never
|
|
45
|
+
: false
|
|
46
|
+
: _<$O, $B, D>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { $Branch } from './$branch.js'
|
|
2
|
+
|
|
3
|
+
export type $Then = $Branch<'$then'>
|
|
4
|
+
export type $Else = $Branch<'$else'>
|
|
5
|
+
|
|
6
|
+
declare const $then: '$then'
|
|
7
|
+
declare const $else: '$else'
|
|
8
|
+
|
|
9
|
+
export namespace $Then {
|
|
10
|
+
export type $Key = '$then'
|
|
11
|
+
export type $Branch = {
|
|
12
|
+
[$then]: $Then
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export namespace $Else {
|
|
17
|
+
export type $Key = '$else'
|
|
18
|
+
export type $Branch = {
|
|
19
|
+
[$else]: $Else
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export namespace $Selection {
|
|
24
|
+
/**
|
|
25
|
+
* Options for selection (if-then-else) logic.
|
|
26
|
+
*
|
|
27
|
+
* The word "selection" refers to the basic elements in structural programming:
|
|
28
|
+
* sequence, selection, and iteration.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* type YourType<
|
|
33
|
+
* T,
|
|
34
|
+
* $Options extends YourType.$Options = YourType.$Branch
|
|
35
|
+
* > = ...
|
|
36
|
+
*
|
|
37
|
+
* namespace YourType {
|
|
38
|
+
* export type $Options = $SelectionOptions
|
|
39
|
+
* export type $Branch = $SelectionBranch
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export type Options = {
|
|
44
|
+
/**
|
|
45
|
+
* Specifies which default selection logic to use.
|
|
46
|
+
*
|
|
47
|
+
* `filter` returns `T` when the condition is met,
|
|
48
|
+
* and returns `never` otherwise.
|
|
49
|
+
*
|
|
50
|
+
* `predicate` returns boolean depends on the condition.
|
|
51
|
+
*
|
|
52
|
+
* Note that setting `$then` and `$else` overrides the default selection logic.
|
|
53
|
+
*/
|
|
54
|
+
selection?: 'predicate' | 'filter' | undefined
|
|
55
|
+
$then?: unknown
|
|
56
|
+
$else?: unknown
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type $BaseOptions = {
|
|
60
|
+
$then?: unknown
|
|
61
|
+
$else?: unknown
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Invert the selection branch.
|
|
66
|
+
*
|
|
67
|
+
* i.e.
|
|
68
|
+
* - `$Then` -> `$Else`
|
|
69
|
+
* - `$Else` -> `$Then`
|
|
70
|
+
*/
|
|
71
|
+
export type Invert<Branch extends $Then | $Else> = Branch extends $Then ? $Else : $Then
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Branch option for selection logic.
|
|
75
|
+
* It allows finely customizing the behavior of your type.
|
|
76
|
+
*
|
|
77
|
+
* Using this as the default value of your `$Options` is the recommended best practice.
|
|
78
|
+
*
|
|
79
|
+
* This encourage consumer of your type to use conditional type to avoid performance issues.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* type YourType<
|
|
84
|
+
* T,
|
|
85
|
+
* $Options extends YourType.$Options = YourType.$Branch
|
|
86
|
+
* > = ...
|
|
87
|
+
*
|
|
88
|
+
* namespace YourType {
|
|
89
|
+
* export type $Options = $SelectionOptions
|
|
90
|
+
* export type $Branch = $SelectionBranch
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* type R = YourType<T> extends infer R
|
|
94
|
+
* ? R extends $Then ? HandleThen
|
|
95
|
+
* : R extends $Else ? HandleElse
|
|
96
|
+
* : never
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export type Branch<$O extends $Selection.Options = {}> = {
|
|
100
|
+
[$then]: $Then
|
|
101
|
+
[$else]: $Else
|
|
102
|
+
} & $O
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Default Options for filter selection logic.
|
|
106
|
+
*
|
|
107
|
+
* `filter` means the logic returns `T` when the condition is met,
|
|
108
|
+
* and returns `never` otherwise.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* type YourType<
|
|
113
|
+
* T,
|
|
114
|
+
* Options extends YourType.$Options = YourType.$Default> = ...
|
|
115
|
+
*
|
|
116
|
+
* namespace YourType {
|
|
117
|
+
* export type $Options = $SelectionOptions
|
|
118
|
+
* export type $Default = $SelectionFilter
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
* type R = YourType<ThenType> // ThenType
|
|
122
|
+
* type X = YourType<ElseType> // never
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export type Filter<T> = {
|
|
126
|
+
selection: 'filter'
|
|
127
|
+
[$then]: T
|
|
128
|
+
[$else]: never
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Default Options for predicate selection logic.
|
|
133
|
+
*
|
|
134
|
+
* `predicate` means the logic returns `true` or `false` depending on the condition.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* type YourType<
|
|
139
|
+
* T,
|
|
140
|
+
* Options extends YourType.$Options = YourType.$Default> = ...
|
|
141
|
+
*
|
|
142
|
+
* namespace YourType {
|
|
143
|
+
* export type $Options = $SelectionOptions
|
|
144
|
+
* export type $Default = $SelectionPredicate
|
|
145
|
+
* }
|
|
146
|
+
*
|
|
147
|
+
* type R = YourType<ThenType> // true
|
|
148
|
+
* type X = YourType<ElseType> // false
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export type Predicate = {
|
|
152
|
+
[$then]: true
|
|
153
|
+
[$else]: false
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Flip the selection options.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* type IsBoolean<T, $Options = $SelectionOptions> = ...
|
|
162
|
+
*
|
|
163
|
+
* type IsNotBoolean<T, $Options = $SelectionOptions> = IsBoolean<T, $FlipSelection<$Options>>
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export type Flip<$Options extends $Selection.Options> = {
|
|
167
|
+
[$then]: $Options['$else']
|
|
168
|
+
[$else]: $Options['$then']
|
|
169
|
+
} & Omit<$Options, '$then' | '$else'>
|
|
170
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Type-level branching
|
|
2
|
+
|
|
3
|
+
This folder contains utility types related to type-level branching.
|
|
4
|
+
|
|
5
|
+
Type-level branching is a core mechanism in [`type-plus`](../../../readme.md) for type-level programming.
|
|
6
|
+
|
|
7
|
+
In essence, type-level branching is a way to separate the type-level logic based on some conditions.
|
|
8
|
+
|
|
9
|
+
There are a few elements to make branching work:
|
|
10
|
+
|
|
11
|
+
## Branch Options
|
|
12
|
+
|
|
13
|
+
To participate in branching, a type should accept a `$O` option.
|
|
14
|
+
|
|
15
|
+
The option would accept a branch property, typically with `unknown` as the type.
|
|
16
|
+
The branch property it accustomed to be named `$<key>`.
|
|
17
|
+
Its key can also be referred to as branch identifier,
|
|
18
|
+
but typically we would just call it by name.
|
|
19
|
+
|
|
20
|
+
Here we use [`IsAny`](../../any/is_any.ts) as an example:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
type IsAny<T, $O extends {
|
|
24
|
+
$unknown?: unknown
|
|
25
|
+
$never?: unknown
|
|
26
|
+
$then?: unknown
|
|
27
|
+
$else?: unknown
|
|
28
|
+
}> = ...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Note that the actual definition of `IsAny` looks different, but the idea is the same.
|
|
32
|
+
|
|
33
|
+
The property keys `$unknown`, `$never`, `$then`, and `$else` are branch identifiers.
|
|
34
|
+
They come from individual options: `$Unknown.$Options`, `$Never.$Options`, `$SelectionOptions`.
|
|
35
|
+
|
|
36
|
+
When you implement your type with branching support,
|
|
37
|
+
you can use these branch options and compose them.
|
|
38
|
+
|
|
39
|
+
## Branch Selectors
|
|
40
|
+
|
|
41
|
+
Branch selectors are used to select a branch during resolution.
|
|
42
|
+
There are a few branch selectors provided in [`type-plus`](../../../readme.md): `$Any`, `$Unknown`, `$Never`, `$Void`, `$Then`, and `$Else`.
|
|
43
|
+
|
|
44
|
+
They are primarily used with `$ResolveBranch` inside the type.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
export type SomeType<T, $O extends $SelectionOptions> = ...
|
|
48
|
+
? $ResolveBranch<$O, [$Then], T>
|
|
49
|
+
: $ResolveBranch<$O, [$Else]>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Branching Types
|
|
53
|
+
|
|
54
|
+
There are a few branching provided in [`type-plus`](../../../readme.md).
|
|
55
|
+
|
|
56
|
+
### Selection Branching
|
|
57
|
+
|
|
58
|
+
The most common branching is `$Selection`, referring to "selection" in the 3 fundamental building blocks of structured programming: sequence, selection, and iteration.
|
|
59
|
+
|
|
60
|
+
Using `IsAny` as an example, we can see how branching works:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
type R = IsAny<any, { $then: 1, $else: 2 }> // 1
|
|
64
|
+
type R = IsAny<number, { $then: 1, $else: 2 }> // 2
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Special Types Branching
|
|
68
|
+
|
|
69
|
+
Special types in TypeScript are: `any`, `unknown`, `never`, and `void`.
|
|
70
|
+
|
|
71
|
+
Besides selection branching, many types in [`type-plus`](../../../readme.md) provide specific branching for special types in TypeScript.
|
|
72
|
+
|
|
73
|
+
Using `IsAny` as an example again:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
type R = IsAny<unknown, { $unknown: 'u', $then: 1, $else: 2 }> // u
|
|
77
|
+
type R = IsAny<never, { $never: 'n', $then: 1, $else: 2 }> // n
|
|
78
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { $ResolveOptions } from '../$resolve_options.js'
|
|
2
|
+
import type { $InputOptions } from '../branch/$input_options.js'
|
|
3
|
+
import type { $Else, $Then } from '../branch/$selection.js'
|
|
4
|
+
|
|
5
|
+
export namespace $Distributive {
|
|
6
|
+
/**
|
|
7
|
+
* Options for controlling if the type is distributive.
|
|
8
|
+
*/
|
|
9
|
+
export type Options = {
|
|
10
|
+
distributive?: boolean | undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default options for `distributive` behavior.
|
|
15
|
+
*
|
|
16
|
+
* By default it is `true`.
|
|
17
|
+
*/
|
|
18
|
+
export type Default = {
|
|
19
|
+
distributive: true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Parse the options for `distributive`.
|
|
24
|
+
*/
|
|
25
|
+
export type Parse<$Options extends Options, $O extends $InputOptions<$Then | $Else> = {}> = $ResolveOptions<
|
|
26
|
+
[$Options['distributive'], Default['distributive']]
|
|
27
|
+
> extends true
|
|
28
|
+
? '$then' extends keyof $O
|
|
29
|
+
? $O['$then']
|
|
30
|
+
: true
|
|
31
|
+
: '$else' extends keyof $O
|
|
32
|
+
? $O['$else']
|
|
33
|
+
: false
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Distributive
|
|
2
|
+
|
|
3
|
+
Distributive in TypeScript means each type in a union type is treated as a separate type during type calculation.
|
|
4
|
+
|
|
5
|
+
Each type in a union type is passed through the type calculation independently.
|
|
6
|
+
|
|
7
|
+
## [`$Distributive.Options`](./$distributive.ts)
|
|
8
|
+
|
|
9
|
+
🏷️ **since 8.0.0**
|
|
10
|
+
|
|
11
|
+
Many types in this library are distributive.
|
|
12
|
+
|
|
13
|
+
`$Distributive.Options` is a type option indicating the type support distributive and non-distributive mode.
|
|
14
|
+
|
|
15
|
+
## [`$Distributive.Default`](./$distributive.ts)
|
|
16
|
+
|
|
17
|
+
🏷️ **since 8.0.0**
|
|
18
|
+
|
|
19
|
+
`$Distributive.Default` is the default value for [`$Distributive.Options`](#distributiveoptions).
|
|
20
|
+
`distributive` is `true` by default.
|
|
21
|
+
|
|
22
|
+
## [`$Distributive.Parse`](./$distributive.ts)
|
|
23
|
+
|
|
24
|
+
🏷️ **since 8.0.0**
|
|
25
|
+
|
|
26
|
+
`$Distributive.Parse<$Option, $O>` checks if a type `$Option` enables distributive or not.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { $Type } from '../$type.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 🧰 *type util*
|
|
5
|
+
*
|
|
6
|
+
* A type-level error.
|
|
7
|
+
*
|
|
8
|
+
* This is analogous to the `Error` class in JavaScript.
|
|
9
|
+
*
|
|
10
|
+
* It can be used in type-level programming to represent an error with a message.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* type T = $Error<'error message'>
|
|
15
|
+
* type T = $Error<'error message', number>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @since 8.0.0
|
|
19
|
+
*/
|
|
20
|
+
export type $Error<M extends string, T = unknown> = M extends any ? $Type<'error', { message: M; type: T }> : never
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import type { $
|
|
1
|
+
import type { $Error } from './$error.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* An error for unexpected failure of infer type.
|
|
4
|
+
* An error to indicate unexpected failure when inferring type.
|
|
7
5
|
*
|
|
8
6
|
* In your type,
|
|
9
7
|
* you can use `T extends infer U extends V` to specify the type of the inferred type `U`.
|
|
10
8
|
*
|
|
11
9
|
* But doing so means you have to do an extra conditional type.
|
|
12
10
|
*
|
|
13
|
-
* This type can be use in the else case to indicate unexpected failure
|
|
11
|
+
* This type can be use in the else case to indicate unexpected failure when inferring type.
|
|
14
12
|
*
|
|
13
|
+
* @example
|
|
15
14
|
* ```ts
|
|
16
15
|
* type F<T> = T extends infer U extends V
|
|
17
16
|
* ? ...your type logic...
|
|
18
17
|
* : InferError<'some message', T>
|
|
19
18
|
* ```
|
|
19
|
+
*
|
|
20
|
+
* @since 8.0.0
|
|
20
21
|
*/
|
|
21
|
-
export type $InferError<M extends string, T = unknown> = M extends any
|
|
22
|
-
? $Type<'error', `Unable to infer: ${M}`, T>
|
|
23
|
-
: never
|
|
22
|
+
export type $InferError<M extends string, T = unknown> = M extends any ? $Error<`Unable to infer: ${M}`, T> : never
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
declare const uniSym: unique symbol
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* @deprecated **💀 deprecated since 8.0.0**: use `$Error` instead.
|
|
5
|
+
*
|
|
4
6
|
* A failed type with message.
|
|
5
7
|
*
|
|
6
8
|
* This is analogous to the `Error` class in JavaScript.
|
|
@@ -19,6 +21,8 @@ export interface Failed<Msg extends string> {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/**
|
|
24
|
+
* @deprecated **💀 deprecated since 8.0.0**: use `$Error` instead.
|
|
25
|
+
*
|
|
22
26
|
* A failed type with message and one additional type.
|
|
23
27
|
*
|
|
24
28
|
* Use this to add a generic type to the failed type.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Type-level Errors
|
|
2
|
+
|
|
3
|
+
This folder contains error types for type-level programming.
|
|
4
|
+
|
|
5
|
+
## [`$Error`](./error.ts)
|
|
6
|
+
|
|
7
|
+
🏷️ **since 8.0.0**
|
|
8
|
+
|
|
9
|
+
`$Error<M, V = unknown>` is a basic type-level error.
|
|
10
|
+
You can use this for some ad-hoc errors.
|
|
11
|
+
|
|
12
|
+
This is analogous to the `Error` class ~~in~~ JavaScript.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
type YourComplexType<A, B, C> = A extends B ?
|
|
16
|
+
... // and many more hard work later...
|
|
17
|
+
: $Error<'you are doing something wrong!'>
|
|
18
|
+
|
|
19
|
+
type YourComplexType<A, B, C> = A extends B ?
|
|
20
|
+
... // and many more hard work later...
|
|
21
|
+
: $Error<'you are doing something wrong!', C>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## [`$InferError`](./infer_error.ts)
|
|
25
|
+
|
|
26
|
+
🏷️ **since 8.0.0**
|
|
27
|
+
|
|
28
|
+
`$InferError<T>` is an error for unexpected failure when inferring type.
|
|
29
|
+
|
|
30
|
+
In your type,
|
|
31
|
+
you can use `T extends infer U extends V` to specify the type of the inferred type `U`.
|
|
32
|
+
|
|
33
|
+
But doing so means you have to do an extra conditional type.
|
|
34
|
+
|
|
35
|
+
This type can be use in the else case to indicate unexpected failure to infer the type.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
type F<T> = T extends infer U extends V
|
|
39
|
+
? ...your type logic...
|
|
40
|
+
: InferError<'some message', T>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## [`Failed`](./failed.ts)
|
|
44
|
+
|
|
45
|
+
💀 **deprecated 8.0.0**: use `$Error` instead.
|
|
46
|
+
|
|
47
|
+
`Failed<Msg>` is a type to describe a failure.
|
|
48
|
+
|
|
49
|
+
Use the same concept to create your own failure types.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
type YourComplexType<A,B,C> = A extends B ?
|
|
53
|
+
... // and many more hard work later...
|
|
54
|
+
: Failed<'you are doing something wrong!'>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
[![Just Code: I failed][failed-type]][failed-type-url]
|
|
58
|
+
|
|
59
|
+
[failed-type]: https://img.youtube.com/vi/3pEXVe6KJO4/0.jpg
|
|
60
|
+
[failed-type-url]: https://www.youtube.com/live/3pEXVe6KJO4
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { $ResolveOptions } from '../$resolve_options.js'
|
|
2
|
+
import type { $InputOptions } from '../branch/$input_options.js'
|
|
3
|
+
import type { $Else, $Then } from '../branch/$selection.js'
|
|
4
|
+
|
|
5
|
+
export namespace $Exact {
|
|
6
|
+
/**
|
|
7
|
+
* Options for controlling if the type perform exact comparison.
|
|
8
|
+
*/
|
|
9
|
+
export type Options = {
|
|
10
|
+
exact?: boolean | undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default options for `exact` behavior.
|
|
15
|
+
*
|
|
16
|
+
* By default it is `false`.
|
|
17
|
+
*/
|
|
18
|
+
export type Default = {
|
|
19
|
+
exact: false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Parse the options for `exact`.
|
|
24
|
+
*/
|
|
25
|
+
export type Parse<$Options extends Options, $O extends $InputOptions<$Then | $Else> = {}> = $ResolveOptions<
|
|
26
|
+
[$Options['exact'], Default['exact']]
|
|
27
|
+
> extends true
|
|
28
|
+
? '$then' extends keyof $O
|
|
29
|
+
? $O['$then']
|
|
30
|
+
: true
|
|
31
|
+
: '$else' extends keyof $O
|
|
32
|
+
? $O['$else']
|
|
33
|
+
: false
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Exact comparison
|
|
2
|
+
|
|
3
|
+
Types in TypeScript is a Set, they can contain subtypes.
|
|
4
|
+
|
|
5
|
+
For example, The `string` type can have string literals,
|
|
6
|
+
`boolean` can be `true` or `false`, etc.
|
|
7
|
+
|
|
8
|
+
When comparing two types, we can compare them loosely or strictly.
|
|
9
|
+
|
|
10
|
+
## [`$Exact.Options`](./$exact.ts)
|
|
11
|
+
|
|
12
|
+
🏷️ **since 8.0.0**
|
|
13
|
+
|
|
14
|
+
`$Exact.Options` is a type option indicating the type support exact comparison.
|
|
15
|
+
|
|
16
|
+
## [`$Exact.Default`](./$exact.ts)
|
|
17
|
+
|
|
18
|
+
🏷️ **since 8.0.0**
|
|
19
|
+
|
|
20
|
+
`$Exact.Default` is the default value for [`$Exact.Options`](#exactoptions).
|
|
21
|
+
`exact` is `false` by default.
|
|
22
|
+
|
|
23
|
+
## [`$Exact.Parse`](./$exact.ts)
|
|
24
|
+
|
|
25
|
+
🏷️ **since 8.0.0**
|
|
26
|
+
|
|
27
|
+
`$Exact.Parse<$Option, $O>` checks if a type `$Option` enables exact comparison or not.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Type-level programming
|
|
2
|
+
|
|
3
|
+
This folder contains utility types for type-level programming.
|
|
4
|
+
|
|
5
|
+
These utility types are not meant to be used directly.
|
|
6
|
+
They are primarily used to build custom types.
|
|
7
|
+
|
|
8
|
+
Most of these types are named with a `$` prefix to distinguish them from regular types.
|
|
9
|
+
|
|
10
|
+
## [`$Type`](./$type.ts)
|
|
11
|
+
|
|
12
|
+
🏷️ **since 8.0.0**
|
|
13
|
+
|
|
14
|
+
`$Type` is a branded type to define unique types for type-level programming.
|
|
15
|
+
|
|
16
|
+
It supports all primitive types and object types.
|
|
17
|
+
|
|
18
|
+
When using object types, the type intersect with the specified type to give easy access to its properties.
|
|
19
|
+
|
|
20
|
+
Internally, it uses the properties `_$type` and `_$value` to store the type and value.
|
|
21
|
+
The type you provide should avoid specifying these properties.
|
|
22
|
+
|
|
23
|
+
If needed, use `$O: { bare: true }` to avoid the intersection.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { $Branch } from '../branch/$branch.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Branch selector for type `any`.
|
|
5
|
+
*/
|
|
6
|
+
export type $Any = $Branch<'$any'>
|
|
7
|
+
|
|
8
|
+
declare const $any: '$any'
|
|
9
|
+
|
|
10
|
+
export namespace $Any {
|
|
11
|
+
export type $Key = '$any'
|
|
12
|
+
/**
|
|
13
|
+
* Options to specifically handles the `any` type.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* type YourType<T, $Options extends $Any.$Options> = ...
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export type $Options = { [$any]?: unknown }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Branch option to specifically handles the `any` type.
|
|
24
|
+
*
|
|
25
|
+
* Use this to finely customize the behavior of your type.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* type YourType<T, $Options extends $Any.Options> = ...
|
|
29
|
+
*
|
|
30
|
+
* type R = YourType<T, $Any.$Branch> extends $Any ? HandleAny : HandleOthers
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export type $Branch = { [$any]: $Any }
|
|
34
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { $Branch } from '../branch/$branch.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Branch selector for type `never`.
|
|
5
|
+
*/
|
|
6
|
+
export type $Never = $Branch<'$never'>
|
|
7
|
+
|
|
8
|
+
declare const $never: '$never'
|
|
9
|
+
|
|
10
|
+
export namespace $Never {
|
|
11
|
+
export type $Key = '$never'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Options to specifically handles the `never` type.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* type YourType<T, $Options extends $Never.$Options> = ...
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type $Options = { [$never]?: unknown }
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Branch option to specifically handles the `never` type.
|
|
25
|
+
*
|
|
26
|
+
* Use this to finely customize the behavior of your type.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* type YourType<T, $Options $Never.$Options> = ...
|
|
31
|
+
*
|
|
32
|
+
* type R = YourType<T, $Never.$Branch> extends $Never ? HandleNever : HandleOthers
|
|
33
|
+
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export type $Branch = { [$never]: $Never }
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Default option for the `$never` branch.
|
|
40
|
+
*
|
|
41
|
+
* Unsurprisingly, defaulting `$never` to `never`.
|
|
42
|
+
*/
|
|
43
|
+
export type $Default = { [$never]: never }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Branch selector for type is not `never`.
|
|
48
|
+
*
|
|
49
|
+
* It is used in [`IsNever`](../../never/is_never.ts).
|
|
50
|
+
*/
|
|
51
|
+
export type $NotNever = $Branch<'$not_never'>
|