type-plus 6.3.0 → 6.4.0
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/README.md +36 -9
- package/cjs/any/any_or_never.d.ts +17 -0
- package/cjs/any/any_or_never.d.ts.map +1 -0
- package/cjs/any/any_or_never.js +3 -0
- package/cjs/any/any_or_never.js.map +1 -0
- package/cjs/any/any_type.d.ts +57 -0
- package/cjs/any/any_type.d.ts.map +1 -0
- package/cjs/any/any_type.js +3 -0
- package/cjs/any/any_type.js.map +1 -0
- package/cjs/array/array.d.ts +32 -0
- package/cjs/array/array.d.ts.map +1 -0
- package/cjs/array/array.js.map +1 -0
- package/cjs/array/array_index.d.ts +37 -0
- package/cjs/array/array_index.d.ts.map +1 -0
- package/cjs/array/array_index.js +3 -0
- package/cjs/array/array_index.js.map +1 -0
- package/cjs/array/array_plus.d.ts +3 -0
- package/cjs/array/array_plus.d.ts.map +1 -0
- package/cjs/array/array_plus.js.map +1 -0
- package/cjs/array/array_type.d.ts +56 -0
- package/cjs/array/array_type.d.ts.map +1 -0
- package/cjs/array/array_type.js +3 -0
- package/cjs/array/array_type.js.map +1 -0
- package/cjs/array/common_prop_keys.d.ts.map +1 -0
- package/cjs/array/common_prop_keys.js.map +1 -0
- package/cjs/array/create_tuple.d.ts +11 -0
- package/cjs/array/create_tuple.d.ts.map +1 -0
- package/cjs/array/create_tuple.js.map +1 -0
- package/cjs/array/drop.d.ts +19 -0
- package/cjs/array/drop.d.ts.map +1 -0
- package/cjs/array/drop.js.map +1 -0
- package/cjs/array/filter.d.ts +9 -0
- package/cjs/array/filter.d.ts.map +1 -0
- package/cjs/array/filter.js.map +1 -0
- package/cjs/array/find_first.d.ts.map +1 -0
- package/cjs/array/find_first.js.map +1 -0
- package/cjs/array/find_last.d.ts.map +1 -0
- package/cjs/array/find_last.js.map +1 -0
- package/cjs/array/head.d.ts.map +1 -0
- package/cjs/array/head.js.map +1 -0
- package/cjs/array/index.d.ts +18 -0
- package/cjs/array/index.d.ts.map +1 -0
- package/cjs/array/index.js +34 -0
- package/cjs/array/index.js.map +1 -0
- package/cjs/array/intersect_of_props.d.ts.map +1 -0
- package/cjs/array/intersect_of_props.js.map +1 -0
- package/cjs/array/last.d.ts.map +1 -0
- package/cjs/array/last.js.map +1 -0
- package/cjs/array/literal_array.d.ts.map +1 -0
- package/cjs/array/literal_array.js.map +1 -0
- package/cjs/array/pad_left.d.ts +6 -0
- package/cjs/array/pad_left.d.ts.map +1 -0
- package/cjs/array/pad_left.js.map +1 -0
- package/cjs/array/reduce_while.d.ts.map +1 -0
- package/cjs/array/reduce_while.js.map +1 -0
- package/cjs/array/reverse.d.ts.map +1 -0
- package/cjs/array/reverse.js.map +1 -0
- package/cjs/array/some.d.ts +8 -0
- package/cjs/array/some.d.ts.map +1 -0
- package/cjs/array/some.js.map +1 -0
- package/cjs/array/tail.d.ts.map +1 -0
- package/cjs/array/tail.js.map +1 -0
- package/cjs/array/union_of_props.d.ts.map +1 -0
- package/cjs/array/union_of_props.js.map +1 -0
- package/cjs/array/union_of_values.d.ts.map +1 -0
- package/cjs/array/union_of_values.js.map +1 -0
- package/cjs/assertion/assert_type.d.ts +34 -0
- package/cjs/assertion/assert_type.d.ts.map +1 -0
- package/cjs/assertion/assert_type.js +107 -0
- package/cjs/assertion/assert_type.js.map +1 -0
- package/cjs/bigint/bigint_type.d.ts +62 -0
- package/cjs/bigint/bigint_type.d.ts.map +1 -0
- package/cjs/bigint/bigint_type.js +3 -0
- package/cjs/bigint/bigint_type.js.map +1 -0
- package/cjs/bigint/strict_bigint_type.d.ts +64 -0
- package/cjs/bigint/strict_bigint_type.d.ts.map +1 -0
- package/cjs/bigint/strict_bigint_type.js +3 -0
- package/cjs/bigint/strict_bigint_type.js.map +1 -0
- package/cjs/boolean/boolean_type.d.ts +64 -0
- package/cjs/boolean/boolean_type.d.ts.map +1 -0
- package/cjs/boolean/boolean_type.js +3 -0
- package/cjs/boolean/boolean_type.js.map +1 -0
- package/cjs/boolean/false_type.d.ts +57 -0
- package/cjs/boolean/false_type.d.ts.map +1 -0
- package/cjs/boolean/false_type.js +3 -0
- package/cjs/boolean/false_type.js.map +1 -0
- package/cjs/boolean/strict_boolean_type.d.ts +61 -0
- package/cjs/boolean/strict_boolean_type.d.ts.map +1 -0
- package/cjs/boolean/strict_boolean_type.js +3 -0
- package/cjs/boolean/strict_boolean_type.js.map +1 -0
- package/cjs/boolean/true_type.d.ts +57 -0
- package/cjs/boolean/true_type.d.ts.map +1 -0
- package/cjs/boolean/true_type.js +3 -0
- package/cjs/boolean/true_type.js.map +1 -0
- package/cjs/composable_types.d.ts +9 -0
- package/cjs/composable_types.d.ts.map +1 -0
- package/cjs/composable_types.js +3 -0
- package/cjs/composable_types.js.map +1 -0
- package/cjs/equal/equal.d.ts +52 -0
- package/cjs/equal/equal.d.ts.map +1 -0
- package/cjs/equal/equal.js +3 -0
- package/cjs/equal/equal.js.map +1 -0
- package/cjs/function/any_function.d.ts +2 -0
- package/cjs/function/any_function.d.ts.map +1 -0
- package/cjs/function/any_function.js +3 -0
- package/cjs/function/any_function.js.map +1 -0
- package/cjs/function/extract_function.d.ts +24 -0
- package/cjs/function/extract_function.d.ts.map +1 -0
- package/cjs/function/extract_function.js +13 -0
- package/cjs/function/extract_function.js.map +1 -0
- package/cjs/function/function_type.d.ts +67 -0
- package/cjs/function/function_type.d.ts.map +1 -0
- package/cjs/function/function_type.js +3 -0
- package/cjs/function/function_type.js.map +1 -0
- package/cjs/function/strict_function_type.d.ts +57 -0
- package/cjs/function/strict_function_type.d.ts.map +1 -0
- package/cjs/function/strict_function_type.js +3 -0
- package/cjs/function/strict_function_type.js.map +1 -0
- package/cjs/functional/Maybe.d.ts +2 -2
- package/cjs/functional/Maybe.d.ts.map +1 -1
- package/cjs/functional/compose.d.ts +2 -2
- package/cjs/functional/compose.d.ts.map +1 -1
- package/cjs/index.d.ts +43 -15
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +11 -15
- package/cjs/index.js.map +1 -1
- package/cjs/json.d.ts +12 -0
- package/cjs/json.d.ts.map +1 -0
- package/cjs/json.js +14 -0
- package/cjs/json.js.map +1 -0
- package/cjs/math/Add.d.ts +4 -3
- package/cjs/math/Add.d.ts.map +1 -1
- package/cjs/math/Digit.d.ts +4 -3
- package/cjs/math/Digit.d.ts.map +1 -1
- package/cjs/math/GreaterThan.d.ts +6 -4
- package/cjs/math/GreaterThan.d.ts.map +1 -1
- package/cjs/math/Max.d.ts +1 -1
- package/cjs/math/Max.d.ts.map +1 -1
- package/cjs/math/Subtract.d.ts +4 -3
- package/cjs/math/Subtract.d.ts.map +1 -1
- package/cjs/never/never_type.d.ts +59 -0
- package/cjs/never/never_type.d.ts.map +1 -0
- package/cjs/never/never_type.js +3 -0
- package/cjs/never/never_type.js.map +1 -0
- package/cjs/nominal/brand.d.ts +21 -0
- package/cjs/nominal/brand.d.ts.map +1 -0
- package/cjs/nominal/brand.js +20 -0
- package/cjs/nominal/brand.js.map +1 -0
- package/cjs/nominal/flavor.d.ts +20 -0
- package/cjs/nominal/flavor.d.ts.map +1 -0
- package/cjs/nominal/flavor.js +20 -0
- package/cjs/nominal/flavor.js.map +1 -0
- package/cjs/nominal/index.d.ts +4 -0
- package/cjs/nominal/index.d.ts.map +1 -0
- package/cjs/nominal/index.js +20 -0
- package/cjs/nominal/index.js.map +1 -0
- package/cjs/nominal/nominal_match.d.ts +5 -0
- package/cjs/nominal/nominal_match.d.ts.map +1 -0
- package/cjs/nominal/nominal_match.js +13 -0
- package/cjs/nominal/nominal_match.js.map +1 -0
- package/cjs/nominal/types.d.ts.map +1 -0
- package/cjs/nominal/types.js.map +1 -0
- package/cjs/null/null_type.d.ts +58 -0
- package/cjs/null/null_type.d.ts.map +1 -0
- package/cjs/null/null_type.js +3 -0
- package/cjs/null/null_type.js.map +1 -0
- package/cjs/number/integer.d.ts +75 -0
- package/cjs/number/integer.d.ts.map +1 -0
- package/cjs/number/integer.js +3 -0
- package/cjs/number/integer.js.map +1 -0
- package/cjs/number/negative.d.ts +78 -0
- package/cjs/number/negative.d.ts.map +1 -0
- package/cjs/number/negative.js +3 -0
- package/cjs/number/negative.js.map +1 -0
- package/cjs/number/number_array.d.ts +3 -0
- package/cjs/number/number_array.d.ts.map +1 -0
- package/cjs/number/number_array.js +3 -0
- package/cjs/number/number_array.js.map +1 -0
- package/cjs/number/number_plus.d.ts +8 -0
- package/cjs/number/number_plus.d.ts.map +1 -0
- package/cjs/number/number_plus.js.map +1 -0
- package/cjs/number/number_type.d.ts +58 -0
- package/cjs/number/number_type.d.ts.map +1 -0
- package/cjs/number/number_type.js +3 -0
- package/cjs/number/number_type.js.map +1 -0
- package/cjs/number/numeric_type.d.ts +67 -0
- package/cjs/number/numeric_type.d.ts.map +1 -0
- package/cjs/number/numeric_type.js +3 -0
- package/cjs/number/numeric_type.js.map +1 -0
- package/cjs/number/positive.d.ts +61 -0
- package/cjs/number/positive.d.ts.map +1 -0
- package/cjs/number/positive.js +3 -0
- package/cjs/number/positive.js.map +1 -0
- package/cjs/number/strict_number_type.d.ts +61 -0
- package/cjs/number/strict_number_type.d.ts.map +1 -0
- package/cjs/number/strict_number_type.js +3 -0
- package/cjs/number/strict_number_type.js.map +1 -0
- package/cjs/object/ANotB.d.ts +1 -1
- package/cjs/object/ANotB.d.ts.map +1 -1
- package/cjs/object/KnownKeys.d.ts +1 -1
- package/cjs/object/KnownKeys.d.ts.map +1 -1
- package/cjs/object/Partial.d.ts +1 -1
- package/cjs/object/Partial.d.ts.map +1 -1
- package/cjs/object/getField.d.ts +1 -1
- package/cjs/object/getField.d.ts.map +1 -1
- package/cjs/object/hasProperty.d.ts +1 -1
- package/cjs/object/hasProperty.d.ts.map +1 -1
- package/cjs/object/index.d.ts +17 -16
- package/cjs/object/index.d.ts.map +1 -1
- package/cjs/object/index.js.map +1 -1
- package/cjs/object/object_type.d.ts +62 -0
- package/cjs/object/object_type.d.ts.map +1 -0
- package/cjs/object/object_type.js +3 -0
- package/cjs/object/object_type.js.map +1 -0
- package/cjs/object/omit.d.ts +1 -1
- package/cjs/object/omit.d.ts.map +1 -1
- package/cjs/object/pick.d.ts +1 -1
- package/cjs/object/pick.d.ts.map +1 -1
- package/cjs/object/properties.d.ts +7 -0
- package/cjs/object/properties.d.ts.map +1 -0
- package/cjs/object/properties.js +3 -0
- package/cjs/object/properties.js.map +1 -0
- package/cjs/predicates/index.d.ts +0 -2
- package/cjs/predicates/index.d.ts.map +1 -1
- package/cjs/predicates/index.js.map +1 -1
- package/cjs/predicates/isType.d.ts +1 -1
- package/cjs/predicates/isType.d.ts.map +1 -1
- package/cjs/predicates/isType.js +2 -1
- package/cjs/predicates/isType.js.map +1 -1
- package/cjs/primitive.d.ts +2 -0
- package/cjs/primitive.d.ts.map +1 -0
- package/cjs/primitive.js +3 -0
- package/cjs/primitive.js.map +1 -0
- package/cjs/string/strict_string_type.d.ts +66 -0
- package/cjs/string/strict_string_type.d.ts.map +1 -0
- package/cjs/string/strict_string_type.js +3 -0
- package/cjs/string/strict_string_type.js.map +1 -0
- package/cjs/string/string_type.d.ts +66 -0
- package/cjs/string/string_type.d.ts.map +1 -0
- package/cjs/string/string_type.js +3 -0
- package/cjs/string/string_type.js.map +1 -0
- package/cjs/symbol/symbol_type.d.ts +60 -0
- package/cjs/symbol/symbol_type.d.ts.map +1 -0
- package/cjs/symbol/symbol_type.js +3 -0
- package/cjs/symbol/symbol_type.js.map +1 -0
- package/cjs/testing/stub.d.ts +2 -2
- package/cjs/testing/stub.d.ts.map +1 -1
- package/cjs/testing/test_type.d.ts +102 -0
- package/cjs/testing/test_type.d.ts.map +1 -0
- package/cjs/testing/test_type.js +105 -0
- package/cjs/testing/test_type.js.map +1 -0
- package/cjs/tuple/tuple_type.d.ts +67 -0
- package/cjs/tuple/tuple_type.d.ts.map +1 -0
- package/cjs/tuple/tuple_type.js +3 -0
- package/cjs/tuple/tuple_type.js.map +1 -0
- package/cjs/undefined/undefined_type.d.ts +61 -0
- package/cjs/undefined/undefined_type.d.ts.map +1 -0
- package/cjs/undefined/undefined_type.js +3 -0
- package/cjs/undefined/undefined_type.js.map +1 -0
- package/cjs/union_keys.d.ts +6 -0
- package/cjs/union_keys.d.ts.map +1 -0
- package/cjs/union_keys.js +3 -0
- package/cjs/union_keys.js.map +1 -0
- package/cjs/union_to_intersection.d.ts +3 -0
- package/cjs/union_to_intersection.d.ts.map +1 -0
- package/cjs/union_to_intersection.js +8 -0
- package/cjs/union_to_intersection.js.map +1 -0
- package/cjs/unknown/unknown_type.d.ts +59 -0
- package/cjs/unknown/unknown_type.d.ts.map +1 -0
- package/cjs/unknown/unknown_type.js +3 -0
- package/cjs/unknown/unknown_type.js.map +1 -0
- package/cjs/void/void_type.d.ts +51 -0
- package/cjs/void/void_type.d.ts.map +1 -0
- package/cjs/void/void_type.js +3 -0
- package/cjs/void/void_type.js.map +1 -0
- package/esm/any/any_or_never.d.ts +17 -0
- package/esm/any/any_or_never.d.ts.map +1 -0
- package/esm/any/any_or_never.js +2 -0
- package/esm/any/any_or_never.js.map +1 -0
- package/esm/any/any_type.d.ts +57 -0
- package/esm/any/any_type.d.ts.map +1 -0
- package/esm/any/any_type.js +2 -0
- package/esm/any/any_type.js.map +1 -0
- package/esm/array/array.d.ts +32 -0
- package/esm/array/array.d.ts.map +1 -0
- package/esm/array/array.js.map +1 -0
- package/esm/array/array_index.d.ts +37 -0
- package/esm/array/array_index.d.ts.map +1 -0
- package/esm/array/array_index.js +2 -0
- package/esm/array/array_index.js.map +1 -0
- package/esm/array/array_plus.d.ts +3 -0
- package/esm/array/array_plus.d.ts.map +1 -0
- package/esm/array/array_plus.js.map +1 -0
- package/esm/array/array_type.d.ts +56 -0
- package/esm/array/array_type.d.ts.map +1 -0
- package/esm/array/array_type.js +2 -0
- package/esm/array/array_type.js.map +1 -0
- package/esm/array/common_prop_keys.d.ts.map +1 -0
- package/esm/array/common_prop_keys.js.map +1 -0
- package/esm/array/create_tuple.d.ts +11 -0
- package/esm/array/create_tuple.d.ts.map +1 -0
- package/esm/array/create_tuple.js.map +1 -0
- package/esm/array/drop.d.ts +19 -0
- package/esm/array/drop.d.ts.map +1 -0
- package/esm/array/drop.js.map +1 -0
- package/esm/array/filter.d.ts +9 -0
- package/esm/array/filter.d.ts.map +1 -0
- package/esm/array/filter.js.map +1 -0
- package/esm/array/find_first.d.ts.map +1 -0
- package/esm/array/find_first.js.map +1 -0
- package/esm/array/find_last.d.ts.map +1 -0
- package/esm/array/find_last.js.map +1 -0
- package/esm/array/head.d.ts.map +1 -0
- package/esm/array/head.js.map +1 -0
- package/esm/array/index.d.ts +18 -0
- package/esm/array/index.d.ts.map +1 -0
- package/esm/array/index.js +18 -0
- package/esm/array/index.js.map +1 -0
- package/esm/array/intersect_of_props.d.ts.map +1 -0
- package/esm/array/intersect_of_props.js.map +1 -0
- package/esm/array/last.d.ts.map +1 -0
- package/esm/array/last.js.map +1 -0
- package/esm/array/literal_array.d.ts.map +1 -0
- package/esm/array/literal_array.js.map +1 -0
- package/esm/array/pad_left.d.ts +6 -0
- package/esm/array/pad_left.d.ts.map +1 -0
- package/esm/array/pad_left.js.map +1 -0
- package/esm/array/reduce_while.d.ts.map +1 -0
- package/esm/array/reduce_while.js.map +1 -0
- package/esm/array/reverse.d.ts.map +1 -0
- package/esm/array/reverse.js.map +1 -0
- package/esm/array/some.d.ts +8 -0
- package/esm/array/some.d.ts.map +1 -0
- package/esm/array/some.js.map +1 -0
- package/esm/array/tail.d.ts.map +1 -0
- package/esm/array/tail.js.map +1 -0
- package/esm/array/union_of_props.d.ts.map +1 -0
- package/esm/array/union_of_props.js.map +1 -0
- package/esm/array/union_of_values.d.ts.map +1 -0
- package/esm/array/union_of_values.js.map +1 -0
- package/esm/assertion/assert_type.d.ts +34 -0
- package/esm/assertion/assert_type.d.ts.map +1 -0
- package/esm/assertion/assert_type.js +103 -0
- package/esm/assertion/assert_type.js.map +1 -0
- package/esm/bigint/bigint_type.d.ts +62 -0
- package/esm/bigint/bigint_type.d.ts.map +1 -0
- package/esm/bigint/bigint_type.js +2 -0
- package/esm/bigint/bigint_type.js.map +1 -0
- package/esm/bigint/strict_bigint_type.d.ts +64 -0
- package/esm/bigint/strict_bigint_type.d.ts.map +1 -0
- package/esm/bigint/strict_bigint_type.js +2 -0
- package/esm/bigint/strict_bigint_type.js.map +1 -0
- package/esm/boolean/boolean_type.d.ts +64 -0
- package/esm/boolean/boolean_type.d.ts.map +1 -0
- package/esm/boolean/boolean_type.js +2 -0
- package/esm/boolean/boolean_type.js.map +1 -0
- package/esm/boolean/false_type.d.ts +57 -0
- package/esm/boolean/false_type.d.ts.map +1 -0
- package/esm/boolean/false_type.js +2 -0
- package/esm/boolean/false_type.js.map +1 -0
- package/esm/boolean/strict_boolean_type.d.ts +61 -0
- package/esm/boolean/strict_boolean_type.d.ts.map +1 -0
- package/esm/boolean/strict_boolean_type.js +2 -0
- package/esm/boolean/strict_boolean_type.js.map +1 -0
- package/esm/boolean/true_type.d.ts +57 -0
- package/esm/boolean/true_type.d.ts.map +1 -0
- package/esm/boolean/true_type.js +2 -0
- package/esm/boolean/true_type.js.map +1 -0
- package/esm/composable_types.d.ts +9 -0
- package/esm/composable_types.d.ts.map +1 -0
- package/esm/composable_types.js +2 -0
- package/esm/composable_types.js.map +1 -0
- package/esm/equal/equal.d.ts +52 -0
- package/esm/equal/equal.d.ts.map +1 -0
- package/esm/equal/equal.js +2 -0
- package/esm/equal/equal.js.map +1 -0
- package/esm/function/any_function.d.ts +2 -0
- package/esm/function/any_function.d.ts.map +1 -0
- package/esm/function/any_function.js +2 -0
- package/esm/function/any_function.js.map +1 -0
- package/esm/function/extract_function.d.ts +24 -0
- package/esm/function/extract_function.d.ts.map +1 -0
- package/esm/function/extract_function.js +9 -0
- package/esm/function/extract_function.js.map +1 -0
- package/esm/function/function_type.d.ts +67 -0
- package/esm/function/function_type.d.ts.map +1 -0
- package/esm/function/function_type.js +2 -0
- package/esm/function/function_type.js.map +1 -0
- package/esm/function/strict_function_type.d.ts +57 -0
- package/esm/function/strict_function_type.d.ts.map +1 -0
- package/esm/function/strict_function_type.js +2 -0
- package/esm/function/strict_function_type.js.map +1 -0
- package/esm/functional/Maybe.d.ts +2 -2
- package/esm/functional/Maybe.d.ts.map +1 -1
- package/esm/functional/compose.d.ts +2 -2
- package/esm/functional/compose.d.ts.map +1 -1
- package/esm/index.d.ts +43 -15
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -12
- package/esm/index.js.map +1 -1
- package/esm/json.d.ts +12 -0
- package/esm/json.d.ts.map +1 -0
- package/esm/json.js +11 -0
- package/esm/json.js.map +1 -0
- package/esm/math/Add.d.ts +4 -3
- package/esm/math/Add.d.ts.map +1 -1
- package/esm/math/Digit.d.ts +4 -3
- package/esm/math/Digit.d.ts.map +1 -1
- package/esm/math/GreaterThan.d.ts +6 -4
- package/esm/math/GreaterThan.d.ts.map +1 -1
- package/esm/math/Max.d.ts +1 -1
- package/esm/math/Max.d.ts.map +1 -1
- package/esm/math/Subtract.d.ts +4 -3
- package/esm/math/Subtract.d.ts.map +1 -1
- package/esm/never/never_type.d.ts +59 -0
- package/esm/never/never_type.d.ts.map +1 -0
- package/esm/never/never_type.js +2 -0
- package/esm/never/never_type.js.map +1 -0
- package/esm/nominal/brand.d.ts +21 -0
- package/esm/nominal/brand.d.ts.map +1 -0
- package/esm/nominal/brand.js +16 -0
- package/esm/nominal/brand.js.map +1 -0
- package/esm/nominal/flavor.d.ts +20 -0
- package/esm/nominal/flavor.d.ts.map +1 -0
- package/esm/nominal/flavor.js +16 -0
- package/esm/nominal/flavor.js.map +1 -0
- package/esm/nominal/index.d.ts +4 -0
- package/esm/nominal/index.d.ts.map +1 -0
- package/esm/nominal/index.js +4 -0
- package/esm/nominal/index.js.map +1 -0
- package/esm/nominal/nominal_match.d.ts +5 -0
- package/esm/nominal/nominal_match.d.ts.map +1 -0
- package/esm/nominal/nominal_match.js +9 -0
- package/esm/nominal/nominal_match.js.map +1 -0
- package/esm/nominal/types.d.ts.map +1 -0
- package/esm/nominal/types.js.map +1 -0
- package/esm/null/null_type.d.ts +58 -0
- package/esm/null/null_type.d.ts.map +1 -0
- package/esm/null/null_type.js +2 -0
- package/esm/null/null_type.js.map +1 -0
- package/esm/number/integer.d.ts +75 -0
- package/esm/number/integer.d.ts.map +1 -0
- package/esm/number/integer.js +2 -0
- package/esm/number/integer.js.map +1 -0
- package/esm/number/negative.d.ts +78 -0
- package/esm/number/negative.d.ts.map +1 -0
- package/esm/number/negative.js +2 -0
- package/esm/number/negative.js.map +1 -0
- package/esm/number/number_array.d.ts +3 -0
- package/esm/number/number_array.d.ts.map +1 -0
- package/esm/number/number_array.js +2 -0
- package/esm/number/number_array.js.map +1 -0
- package/esm/number/number_plus.d.ts +8 -0
- package/esm/number/number_plus.d.ts.map +1 -0
- package/esm/number/number_plus.js.map +1 -0
- package/esm/number/number_type.d.ts +58 -0
- package/esm/number/number_type.d.ts.map +1 -0
- package/esm/number/number_type.js +2 -0
- package/esm/number/number_type.js.map +1 -0
- package/esm/number/numeric_type.d.ts +67 -0
- package/esm/number/numeric_type.d.ts.map +1 -0
- package/esm/number/numeric_type.js +2 -0
- package/esm/number/numeric_type.js.map +1 -0
- package/esm/number/positive.d.ts +61 -0
- package/esm/number/positive.d.ts.map +1 -0
- package/esm/number/positive.js +2 -0
- package/esm/number/positive.js.map +1 -0
- package/esm/number/strict_number_type.d.ts +61 -0
- package/esm/number/strict_number_type.d.ts.map +1 -0
- package/esm/number/strict_number_type.js +2 -0
- package/esm/number/strict_number_type.js.map +1 -0
- package/esm/object/ANotB.d.ts +1 -1
- package/esm/object/ANotB.d.ts.map +1 -1
- package/esm/object/KnownKeys.d.ts +1 -1
- package/esm/object/KnownKeys.d.ts.map +1 -1
- package/esm/object/Partial.d.ts +1 -1
- package/esm/object/Partial.d.ts.map +1 -1
- package/esm/object/getField.d.ts +1 -1
- package/esm/object/getField.d.ts.map +1 -1
- package/esm/object/hasProperty.d.ts +1 -1
- package/esm/object/hasProperty.d.ts.map +1 -1
- package/esm/object/index.d.ts +17 -16
- package/esm/object/index.d.ts.map +1 -1
- package/esm/object/index.js.map +1 -1
- package/esm/object/object_type.d.ts +62 -0
- package/esm/object/object_type.d.ts.map +1 -0
- package/esm/object/object_type.js +2 -0
- package/esm/object/object_type.js.map +1 -0
- package/esm/object/omit.d.ts +1 -1
- package/esm/object/omit.d.ts.map +1 -1
- package/esm/object/pick.d.ts +1 -1
- package/esm/object/pick.d.ts.map +1 -1
- package/esm/object/properties.d.ts +7 -0
- package/esm/object/properties.d.ts.map +1 -0
- package/esm/object/properties.js +2 -0
- package/esm/object/properties.js.map +1 -0
- package/esm/predicates/index.d.ts +0 -2
- package/esm/predicates/index.d.ts.map +1 -1
- package/esm/predicates/index.js.map +1 -1
- package/esm/predicates/isType.d.ts +1 -1
- package/esm/predicates/isType.d.ts.map +1 -1
- package/esm/predicates/isType.js +2 -1
- package/esm/predicates/isType.js.map +1 -1
- package/esm/primitive.d.ts +2 -0
- package/esm/primitive.d.ts.map +1 -0
- package/esm/primitive.js +2 -0
- package/esm/primitive.js.map +1 -0
- package/esm/string/strict_string_type.d.ts +66 -0
- package/esm/string/strict_string_type.d.ts.map +1 -0
- package/esm/string/strict_string_type.js +2 -0
- package/esm/string/strict_string_type.js.map +1 -0
- package/esm/string/string_type.d.ts +66 -0
- package/esm/string/string_type.d.ts.map +1 -0
- package/esm/string/string_type.js +2 -0
- package/esm/string/string_type.js.map +1 -0
- package/esm/symbol/symbol_type.d.ts +60 -0
- package/esm/symbol/symbol_type.d.ts.map +1 -0
- package/esm/symbol/symbol_type.js +2 -0
- package/esm/symbol/symbol_type.js.map +1 -0
- package/esm/testing/stub.d.ts +2 -2
- package/esm/testing/stub.d.ts.map +1 -1
- package/esm/testing/test_type.d.ts +102 -0
- package/esm/testing/test_type.d.ts.map +1 -0
- package/esm/testing/test_type.js +102 -0
- package/esm/testing/test_type.js.map +1 -0
- package/esm/tuple/tuple_type.d.ts +67 -0
- package/esm/tuple/tuple_type.d.ts.map +1 -0
- package/esm/tuple/tuple_type.js +2 -0
- package/esm/tuple/tuple_type.js.map +1 -0
- package/esm/undefined/undefined_type.d.ts +61 -0
- package/esm/undefined/undefined_type.d.ts.map +1 -0
- package/esm/undefined/undefined_type.js +2 -0
- package/esm/undefined/undefined_type.js.map +1 -0
- package/esm/union_keys.d.ts +6 -0
- package/esm/union_keys.d.ts.map +1 -0
- package/esm/union_keys.js +2 -0
- package/esm/union_keys.js.map +1 -0
- package/esm/union_to_intersection.d.ts +3 -0
- package/esm/union_to_intersection.d.ts.map +1 -0
- package/esm/union_to_intersection.js +4 -0
- package/esm/union_to_intersection.js.map +1 -0
- package/esm/unknown/unknown_type.d.ts +59 -0
- package/esm/unknown/unknown_type.d.ts.map +1 -0
- package/esm/unknown/unknown_type.js +2 -0
- package/esm/unknown/unknown_type.js.map +1 -0
- package/esm/void/void_type.d.ts +51 -0
- package/esm/void/void_type.d.ts.map +1 -0
- package/esm/void/void_type.js +2 -0
- package/esm/void/void_type.js.map +1 -0
- package/package.json +7 -25
- package/ts/any/any_or_never.ts +17 -0
- package/ts/any/any_type.ts +60 -0
- package/ts/any/readme.md +26 -0
- package/ts/array/array.ts +37 -0
- package/ts/array/array_index.ts +70 -0
- package/ts/array/array_plus.ts +2 -0
- package/ts/array/array_type.ts +61 -0
- package/ts/array/create_tuple.ts +17 -0
- package/ts/array/drop.ts +71 -0
- package/ts/array/filter.ts +27 -0
- package/ts/array/index.ts +17 -0
- package/ts/array/pad_left.ts +16 -0
- package/ts/array/readme.md +32 -0
- package/ts/array/some.ts +33 -0
- package/ts/assertion/assert_type.ts +107 -0
- package/ts/assertion/readme.md +15 -0
- package/ts/bigint/bigint_type.ts +65 -0
- package/ts/bigint/readme.md +51 -0
- package/ts/bigint/strict_bigint_type.ts +69 -0
- package/ts/boolean/boolean_type.ts +69 -0
- package/ts/boolean/false_type.ts +61 -0
- package/ts/boolean/readme.md +85 -0
- package/ts/boolean/strict_boolean_type.ts +65 -0
- package/ts/boolean/true_type.ts +61 -0
- package/ts/composable_types.ts +9 -0
- package/ts/equal/equal.ts +88 -0
- package/ts/equal/readme.md +31 -0
- package/ts/function/extract_function.ts +29 -0
- package/ts/function/function_type.ts +72 -0
- package/ts/function/readme.md +84 -0
- package/ts/function/strict_function_type.ts +61 -0
- package/ts/functional/Maybe.ts +2 -2
- package/ts/functional/compose.ts +2 -2
- package/ts/index.ts +90 -19
- package/ts/math/Add.ts +5 -4
- package/ts/math/Digit.ts +4 -3
- package/ts/math/GreaterThan.ts +7 -5
- package/ts/math/Max.ts +1 -1
- package/ts/math/Subtract.ts +5 -5
- package/ts/never/never_type.ts +65 -0
- package/ts/never/readme.md +37 -0
- package/ts/nominal/brand.ts +35 -0
- package/ts/nominal/flavor.ts +38 -0
- package/ts/nominal/index.ts +3 -0
- package/ts/nominal/nominal_match.ts +22 -0
- package/ts/null/null_type.ts +61 -0
- package/ts/null/readme.md +24 -0
- package/ts/number/integer.ts +81 -0
- package/ts/number/negative.ts +109 -0
- package/ts/number/number_array.ts +15 -0
- package/ts/number/number_plus.ts +20 -0
- package/ts/number/number_type.ts +61 -0
- package/ts/number/numeric_type.ts +72 -0
- package/ts/number/positive.ts +68 -0
- package/ts/number/readme.md +155 -0
- package/ts/number/strict_number_type.ts +65 -0
- package/ts/object/ANotB.ts +1 -1
- package/ts/object/KnownKeys.ts +1 -1
- package/ts/object/Partial.ts +1 -1
- package/ts/object/getField.ts +1 -1
- package/ts/object/hasProperty.ts +1 -1
- package/ts/object/index.ts +17 -16
- package/ts/object/object_type.ts +65 -0
- package/ts/object/omit.ts +1 -1
- package/ts/object/pick.ts +1 -1
- package/ts/object/properties.ts +4 -0
- package/ts/object/readme.md +28 -0
- package/ts/predicates/index.ts +0 -3
- package/ts/predicates/isType.ts +4 -2
- package/ts/primitive.ts +10 -0
- package/ts/string/readme.md +43 -0
- package/ts/string/strict_string_type.ts +69 -0
- package/ts/string/string_type.ts +69 -0
- package/ts/symbol/readme.md +34 -0
- package/ts/symbol/symbol_type.ts +65 -0
- package/ts/testing/readme.md +19 -0
- package/ts/testing/stub.ts +2 -2
- package/ts/testing/test_type.ts +127 -0
- package/ts/tuple/readme.md +24 -4
- package/ts/tuple/tuple_type.ts +72 -0
- package/ts/undefined/readme.md +18 -0
- package/ts/undefined/undefined_type.ts +65 -0
- package/ts/unknown/readme.md +27 -0
- package/ts/unknown/unknown_type.ts +63 -0
- package/ts/void/readme.md +26 -0
- package/ts/void/void_type.ts +58 -0
- package/cjs/ComposableTypes.d.ts +0 -9
- package/cjs/ComposableTypes.d.ts.map +0 -1
- package/cjs/ComposableTypes.js +0 -3
- package/cjs/ComposableTypes.js.map +0 -1
- package/cjs/JSONTypes.d.ts +0 -12
- package/cjs/JSONTypes.d.ts.map +0 -1
- package/cjs/JSONTypes.js +0 -14
- package/cjs/JSONTypes.js.map +0 -1
- package/cjs/PrimitiveTypes.d.ts +0 -3
- package/cjs/PrimitiveTypes.d.ts.map +0 -1
- package/cjs/PrimitiveTypes.js +0 -4
- package/cjs/PrimitiveTypes.js.map +0 -1
- package/cjs/UnionKeys.d.ts +0 -6
- package/cjs/UnionKeys.d.ts.map +0 -1
- package/cjs/UnionKeys.js +0 -3
- package/cjs/UnionKeys.js.map +0 -1
- package/cjs/UnionToIntersection.d.ts +0 -3
- package/cjs/UnionToIntersection.d.ts.map +0 -1
- package/cjs/UnionToIntersection.js +0 -8
- package/cjs/UnionToIntersection.js.map +0 -1
- package/cjs/any_plus/any.d.ts +0 -29
- package/cjs/any_plus/any.d.ts.map +0 -1
- package/cjs/any_plus/any.js +0 -3
- package/cjs/any_plus/any.js.map +0 -1
- package/cjs/any_plus/index.d.ts +0 -2
- package/cjs/any_plus/index.d.ts.map +0 -1
- package/cjs/any_plus/index.js +0 -3
- package/cjs/any_plus/index.js.map +0 -1
- package/cjs/array_plus/array.d.ts +0 -42
- package/cjs/array_plus/array.d.ts.map +0 -1
- package/cjs/array_plus/array.js.map +0 -1
- package/cjs/array_plus/array_number.d.ts +0 -4
- package/cjs/array_plus/array_number.d.ts.map +0 -1
- package/cjs/array_plus/array_number.js +0 -3
- package/cjs/array_plus/array_number.js.map +0 -1
- package/cjs/array_plus/array_plus.d.ts +0 -35
- package/cjs/array_plus/array_plus.d.ts.map +0 -1
- package/cjs/array_plus/array_plus.js.map +0 -1
- package/cjs/array_plus/common_prop_keys.d.ts.map +0 -1
- package/cjs/array_plus/common_prop_keys.js.map +0 -1
- package/cjs/array_plus/create_tuple.d.ts +0 -10
- package/cjs/array_plus/create_tuple.d.ts.map +0 -1
- package/cjs/array_plus/create_tuple.js.map +0 -1
- package/cjs/array_plus/drop.d.ts +0 -19
- package/cjs/array_plus/drop.d.ts.map +0 -1
- package/cjs/array_plus/drop.js.map +0 -1
- package/cjs/array_plus/filter.d.ts +0 -10
- package/cjs/array_plus/filter.d.ts.map +0 -1
- package/cjs/array_plus/filter.js.map +0 -1
- package/cjs/array_plus/find_first.d.ts.map +0 -1
- package/cjs/array_plus/find_first.js.map +0 -1
- package/cjs/array_plus/find_last.d.ts.map +0 -1
- package/cjs/array_plus/find_last.js.map +0 -1
- package/cjs/array_plus/head.d.ts.map +0 -1
- package/cjs/array_plus/head.js.map +0 -1
- package/cjs/array_plus/index.d.ts +0 -20
- package/cjs/array_plus/index.d.ts.map +0 -1
- package/cjs/array_plus/index.js +0 -20
- package/cjs/array_plus/index.js.map +0 -1
- package/cjs/array_plus/intersect_of_props.d.ts.map +0 -1
- package/cjs/array_plus/intersect_of_props.js.map +0 -1
- package/cjs/array_plus/is_array.d.ts +0 -2
- package/cjs/array_plus/is_array.d.ts.map +0 -1
- package/cjs/array_plus/is_array.js +0 -3
- package/cjs/array_plus/is_array.js.map +0 -1
- package/cjs/array_plus/last.d.ts.map +0 -1
- package/cjs/array_plus/last.js.map +0 -1
- package/cjs/array_plus/literal_array.d.ts.map +0 -1
- package/cjs/array_plus/literal_array.js.map +0 -1
- package/cjs/array_plus/pad_left.d.ts +0 -6
- package/cjs/array_plus/pad_left.d.ts.map +0 -1
- package/cjs/array_plus/pad_left.js.map +0 -1
- package/cjs/array_plus/reduce_while.d.ts.map +0 -1
- package/cjs/array_plus/reduce_while.js.map +0 -1
- package/cjs/array_plus/reverse.d.ts.map +0 -1
- package/cjs/array_plus/reverse.js.map +0 -1
- package/cjs/array_plus/some.d.ts +0 -8
- package/cjs/array_plus/some.d.ts.map +0 -1
- package/cjs/array_plus/some.js.map +0 -1
- package/cjs/array_plus/tail.d.ts.map +0 -1
- package/cjs/array_plus/tail.js.map +0 -1
- package/cjs/array_plus/union_of_props.d.ts.map +0 -1
- package/cjs/array_plus/union_of_props.js.map +0 -1
- package/cjs/array_plus/union_of_values.d.ts.map +0 -1
- package/cjs/array_plus/union_of_values.js.map +0 -1
- package/cjs/assertion/assertType.d.ts +0 -34
- package/cjs/assertion/assertType.d.ts.map +0 -1
- package/cjs/assertion/assertType.js +0 -107
- package/cjs/assertion/assertType.js.map +0 -1
- package/cjs/assertion/index.d.ts +0 -2
- package/cjs/assertion/index.d.ts.map +0 -1
- package/cjs/assertion/index.js +0 -18
- package/cjs/assertion/index.js.map +0 -1
- package/cjs/function/AnyFunction.d.ts +0 -2
- package/cjs/function/AnyFunction.d.ts.map +0 -1
- package/cjs/function/AnyFunction.js +0 -3
- package/cjs/function/AnyFunction.js.map +0 -1
- package/cjs/function/ExtractFunction.d.ts +0 -15
- package/cjs/function/ExtractFunction.d.ts.map +0 -1
- package/cjs/function/ExtractFunction.js +0 -13
- package/cjs/function/ExtractFunction.js.map +0 -1
- package/cjs/function/index.d.ts +0 -3
- package/cjs/function/index.d.ts.map +0 -1
- package/cjs/function/index.js +0 -18
- package/cjs/function/index.js.map +0 -1
- package/cjs/nominal-types/Brand.d.ts +0 -21
- package/cjs/nominal-types/Brand.d.ts.map +0 -1
- package/cjs/nominal-types/Brand.js +0 -20
- package/cjs/nominal-types/Brand.js.map +0 -1
- package/cjs/nominal-types/Flavor.d.ts +0 -20
- package/cjs/nominal-types/Flavor.d.ts.map +0 -1
- package/cjs/nominal-types/Flavor.js +0 -20
- package/cjs/nominal-types/Flavor.js.map +0 -1
- package/cjs/nominal-types/index.d.ts +0 -4
- package/cjs/nominal-types/index.d.ts.map +0 -1
- package/cjs/nominal-types/index.js +0 -20
- package/cjs/nominal-types/index.js.map +0 -1
- package/cjs/nominal-types/nominalMatch.d.ts +0 -5
- package/cjs/nominal-types/nominalMatch.d.ts.map +0 -1
- package/cjs/nominal-types/nominalMatch.js +0 -13
- package/cjs/nominal-types/nominalMatch.js.map +0 -1
- package/cjs/nominal-types/types.d.ts.map +0 -1
- package/cjs/nominal-types/types.js.map +0 -1
- package/cjs/number_plus/index.d.ts +0 -2
- package/cjs/number_plus/index.d.ts.map +0 -1
- package/cjs/number_plus/index.js +0 -3
- package/cjs/number_plus/index.js.map +0 -1
- package/cjs/number_plus/number.d.ts +0 -128
- package/cjs/number_plus/number.d.ts.map +0 -1
- package/cjs/number_plus/number.js +0 -3
- package/cjs/number_plus/number.js.map +0 -1
- package/cjs/number_plus/number_plus.d.ts +0 -2
- package/cjs/number_plus/number_plus.d.ts.map +0 -1
- package/cjs/number_plus/number_plus.js.map +0 -1
- package/cjs/predicates/Equal.d.ts +0 -38
- package/cjs/predicates/Equal.d.ts.map +0 -1
- package/cjs/predicates/Equal.js +0 -3
- package/cjs/predicates/Equal.js.map +0 -1
- package/cjs/testing/index.d.ts +0 -2
- package/cjs/testing/index.d.ts.map +0 -1
- package/cjs/testing/index.js +0 -18
- package/cjs/testing/index.js.map +0 -1
- package/cjs/tuple/index.d.ts +0 -2
- package/cjs/tuple/index.d.ts.map +0 -1
- package/cjs/tuple/index.js +0 -3
- package/cjs/tuple/index.js.map +0 -1
- package/cjs/tuple/tuple.d.ts +0 -16
- package/cjs/tuple/tuple.d.ts.map +0 -1
- package/cjs/tuple/tuple.js +0 -3
- package/cjs/tuple/tuple.js.map +0 -1
- package/esm/ComposableTypes.d.ts +0 -9
- package/esm/ComposableTypes.d.ts.map +0 -1
- package/esm/ComposableTypes.js +0 -2
- package/esm/ComposableTypes.js.map +0 -1
- package/esm/JSONTypes.d.ts +0 -12
- package/esm/JSONTypes.d.ts.map +0 -1
- package/esm/JSONTypes.js +0 -11
- package/esm/JSONTypes.js.map +0 -1
- package/esm/PrimitiveTypes.d.ts +0 -3
- package/esm/PrimitiveTypes.d.ts.map +0 -1
- package/esm/PrimitiveTypes.js +0 -3
- package/esm/PrimitiveTypes.js.map +0 -1
- package/esm/UnionKeys.d.ts +0 -6
- package/esm/UnionKeys.d.ts.map +0 -1
- package/esm/UnionKeys.js +0 -2
- package/esm/UnionKeys.js.map +0 -1
- package/esm/UnionToIntersection.d.ts +0 -3
- package/esm/UnionToIntersection.d.ts.map +0 -1
- package/esm/UnionToIntersection.js +0 -4
- package/esm/UnionToIntersection.js.map +0 -1
- package/esm/any_plus/any.d.ts +0 -29
- package/esm/any_plus/any.d.ts.map +0 -1
- package/esm/any_plus/any.js +0 -2
- package/esm/any_plus/any.js.map +0 -1
- package/esm/any_plus/index.d.ts +0 -2
- package/esm/any_plus/index.d.ts.map +0 -1
- package/esm/any_plus/index.js +0 -2
- package/esm/any_plus/index.js.map +0 -1
- package/esm/array_plus/array.d.ts +0 -42
- package/esm/array_plus/array.d.ts.map +0 -1
- package/esm/array_plus/array.js.map +0 -1
- package/esm/array_plus/array_number.d.ts +0 -4
- package/esm/array_plus/array_number.d.ts.map +0 -1
- package/esm/array_plus/array_number.js +0 -2
- package/esm/array_plus/array_number.js.map +0 -1
- package/esm/array_plus/array_plus.d.ts +0 -35
- package/esm/array_plus/array_plus.d.ts.map +0 -1
- package/esm/array_plus/array_plus.js.map +0 -1
- package/esm/array_plus/common_prop_keys.d.ts.map +0 -1
- package/esm/array_plus/common_prop_keys.js.map +0 -1
- package/esm/array_plus/create_tuple.d.ts +0 -10
- package/esm/array_plus/create_tuple.d.ts.map +0 -1
- package/esm/array_plus/create_tuple.js.map +0 -1
- package/esm/array_plus/drop.d.ts +0 -19
- package/esm/array_plus/drop.d.ts.map +0 -1
- package/esm/array_plus/drop.js.map +0 -1
- package/esm/array_plus/filter.d.ts +0 -10
- package/esm/array_plus/filter.d.ts.map +0 -1
- package/esm/array_plus/filter.js.map +0 -1
- package/esm/array_plus/find_first.d.ts.map +0 -1
- package/esm/array_plus/find_first.js.map +0 -1
- package/esm/array_plus/find_last.d.ts.map +0 -1
- package/esm/array_plus/find_last.js.map +0 -1
- package/esm/array_plus/head.d.ts.map +0 -1
- package/esm/array_plus/head.js.map +0 -1
- package/esm/array_plus/index.d.ts +0 -20
- package/esm/array_plus/index.d.ts.map +0 -1
- package/esm/array_plus/index.js +0 -4
- package/esm/array_plus/index.js.map +0 -1
- package/esm/array_plus/intersect_of_props.d.ts.map +0 -1
- package/esm/array_plus/intersect_of_props.js.map +0 -1
- package/esm/array_plus/is_array.d.ts +0 -2
- package/esm/array_plus/is_array.d.ts.map +0 -1
- package/esm/array_plus/is_array.js +0 -2
- package/esm/array_plus/is_array.js.map +0 -1
- package/esm/array_plus/last.d.ts.map +0 -1
- package/esm/array_plus/last.js.map +0 -1
- package/esm/array_plus/literal_array.d.ts.map +0 -1
- package/esm/array_plus/literal_array.js.map +0 -1
- package/esm/array_plus/pad_left.d.ts +0 -6
- package/esm/array_plus/pad_left.d.ts.map +0 -1
- package/esm/array_plus/pad_left.js.map +0 -1
- package/esm/array_plus/reduce_while.d.ts.map +0 -1
- package/esm/array_plus/reduce_while.js.map +0 -1
- package/esm/array_plus/reverse.d.ts.map +0 -1
- package/esm/array_plus/reverse.js.map +0 -1
- package/esm/array_plus/some.d.ts +0 -8
- package/esm/array_plus/some.d.ts.map +0 -1
- package/esm/array_plus/some.js.map +0 -1
- package/esm/array_plus/tail.d.ts.map +0 -1
- package/esm/array_plus/tail.js.map +0 -1
- package/esm/array_plus/union_of_props.d.ts.map +0 -1
- package/esm/array_plus/union_of_props.js.map +0 -1
- package/esm/array_plus/union_of_values.d.ts.map +0 -1
- package/esm/array_plus/union_of_values.js.map +0 -1
- package/esm/assertion/assertType.d.ts +0 -34
- package/esm/assertion/assertType.d.ts.map +0 -1
- package/esm/assertion/assertType.js +0 -103
- package/esm/assertion/assertType.js.map +0 -1
- package/esm/assertion/index.d.ts +0 -2
- package/esm/assertion/index.d.ts.map +0 -1
- package/esm/assertion/index.js +0 -2
- package/esm/assertion/index.js.map +0 -1
- package/esm/function/AnyFunction.d.ts +0 -2
- package/esm/function/AnyFunction.d.ts.map +0 -1
- package/esm/function/AnyFunction.js +0 -2
- package/esm/function/AnyFunction.js.map +0 -1
- package/esm/function/ExtractFunction.d.ts +0 -15
- package/esm/function/ExtractFunction.d.ts.map +0 -1
- package/esm/function/ExtractFunction.js +0 -9
- package/esm/function/ExtractFunction.js.map +0 -1
- package/esm/function/index.d.ts +0 -3
- package/esm/function/index.d.ts.map +0 -1
- package/esm/function/index.js +0 -2
- package/esm/function/index.js.map +0 -1
- package/esm/nominal-types/Brand.d.ts +0 -21
- package/esm/nominal-types/Brand.d.ts.map +0 -1
- package/esm/nominal-types/Brand.js +0 -16
- package/esm/nominal-types/Brand.js.map +0 -1
- package/esm/nominal-types/Flavor.d.ts +0 -20
- package/esm/nominal-types/Flavor.d.ts.map +0 -1
- package/esm/nominal-types/Flavor.js +0 -16
- package/esm/nominal-types/Flavor.js.map +0 -1
- package/esm/nominal-types/index.d.ts +0 -4
- package/esm/nominal-types/index.d.ts.map +0 -1
- package/esm/nominal-types/index.js +0 -4
- package/esm/nominal-types/index.js.map +0 -1
- package/esm/nominal-types/nominalMatch.d.ts +0 -5
- package/esm/nominal-types/nominalMatch.d.ts.map +0 -1
- package/esm/nominal-types/nominalMatch.js +0 -9
- package/esm/nominal-types/nominalMatch.js.map +0 -1
- package/esm/nominal-types/types.d.ts.map +0 -1
- package/esm/nominal-types/types.js.map +0 -1
- package/esm/number_plus/index.d.ts +0 -2
- package/esm/number_plus/index.d.ts.map +0 -1
- package/esm/number_plus/index.js +0 -2
- package/esm/number_plus/index.js.map +0 -1
- package/esm/number_plus/number.d.ts +0 -128
- package/esm/number_plus/number.d.ts.map +0 -1
- package/esm/number_plus/number.js +0 -2
- package/esm/number_plus/number.js.map +0 -1
- package/esm/number_plus/number_plus.d.ts +0 -2
- package/esm/number_plus/number_plus.d.ts.map +0 -1
- package/esm/number_plus/number_plus.js.map +0 -1
- package/esm/predicates/Equal.d.ts +0 -38
- package/esm/predicates/Equal.d.ts.map +0 -1
- package/esm/predicates/Equal.js +0 -2
- package/esm/predicates/Equal.js.map +0 -1
- package/esm/testing/index.d.ts +0 -2
- package/esm/testing/index.d.ts.map +0 -1
- package/esm/testing/index.js +0 -2
- package/esm/testing/index.js.map +0 -1
- package/esm/tuple/index.d.ts +0 -2
- package/esm/tuple/index.d.ts.map +0 -1
- package/esm/tuple/index.js +0 -2
- package/esm/tuple/index.js.map +0 -1
- package/esm/tuple/tuple.d.ts +0 -16
- package/esm/tuple/tuple.d.ts.map +0 -1
- package/esm/tuple/tuple.js +0 -2
- package/esm/tuple/tuple.js.map +0 -1
- package/ts/ComposableTypes.ts +0 -10
- package/ts/PrimitiveTypes.ts +0 -15
- package/ts/any_plus/any.ts +0 -29
- package/ts/any_plus/index.ts +0 -1
- package/ts/array_plus/array.ts +0 -48
- package/ts/array_plus/array_number.ts +0 -12
- package/ts/array_plus/array_plus.ts +0 -66
- package/ts/array_plus/create_tuple.ts +0 -16
- package/ts/array_plus/drop.ts +0 -71
- package/ts/array_plus/filter.ts +0 -28
- package/ts/array_plus/index.ts +0 -19
- package/ts/array_plus/is_array.ts +0 -1
- package/ts/array_plus/pad_left.ts +0 -16
- package/ts/array_plus/some.ts +0 -33
- package/ts/assertion/assertType.ts +0 -107
- package/ts/assertion/index.ts +0 -1
- package/ts/function/ExtractFunction.ts +0 -20
- package/ts/function/index.ts +0 -2
- package/ts/nominal-types/Brand.ts +0 -34
- package/ts/nominal-types/Flavor.ts +0 -35
- package/ts/nominal-types/index.ts +0 -3
- package/ts/nominal-types/nominalMatch.ts +0 -22
- package/ts/number_plus/index.ts +0 -1
- package/ts/number_plus/number.ts +0 -149
- package/ts/number_plus/number_plus.ts +0 -1
- package/ts/predicates/Equal.ts +0 -43
- package/ts/testing/index.ts +0 -1
- package/ts/tuple/index.ts +0 -1
- package/ts/tuple/tuple.ts +0 -20
- /package/cjs/{array_plus → array}/array.js +0 -0
- /package/cjs/{array_plus → array}/array_plus.js +0 -0
- /package/cjs/{array_plus → array}/common_prop_keys.d.ts +0 -0
- /package/cjs/{array_plus → array}/common_prop_keys.js +0 -0
- /package/cjs/{array_plus → array}/create_tuple.js +0 -0
- /package/cjs/{array_plus → array}/drop.js +0 -0
- /package/cjs/{array_plus → array}/filter.js +0 -0
- /package/cjs/{array_plus → array}/find_first.d.ts +0 -0
- /package/cjs/{array_plus → array}/find_first.js +0 -0
- /package/cjs/{array_plus → array}/find_last.d.ts +0 -0
- /package/cjs/{array_plus → array}/find_last.js +0 -0
- /package/cjs/{array_plus → array}/head.d.ts +0 -0
- /package/cjs/{array_plus → array}/head.js +0 -0
- /package/cjs/{array_plus → array}/intersect_of_props.d.ts +0 -0
- /package/cjs/{array_plus → array}/intersect_of_props.js +0 -0
- /package/cjs/{array_plus → array}/last.d.ts +0 -0
- /package/cjs/{array_plus → array}/last.js +0 -0
- /package/cjs/{array_plus → array}/literal_array.d.ts +0 -0
- /package/cjs/{array_plus → array}/literal_array.js +0 -0
- /package/cjs/{array_plus → array}/pad_left.js +0 -0
- /package/cjs/{array_plus → array}/reduce_while.d.ts +0 -0
- /package/cjs/{array_plus → array}/reduce_while.js +0 -0
- /package/cjs/{array_plus → array}/reverse.d.ts +0 -0
- /package/cjs/{array_plus → array}/reverse.js +0 -0
- /package/cjs/{array_plus → array}/some.js +0 -0
- /package/cjs/{array_plus → array}/tail.d.ts +0 -0
- /package/cjs/{array_plus → array}/tail.js +0 -0
- /package/cjs/{array_plus → array}/union_of_props.d.ts +0 -0
- /package/cjs/{array_plus → array}/union_of_props.js +0 -0
- /package/cjs/{array_plus → array}/union_of_values.d.ts +0 -0
- /package/cjs/{array_plus → array}/union_of_values.js +0 -0
- /package/cjs/{nominal-types → nominal}/types.d.ts +0 -0
- /package/cjs/{nominal-types → nominal}/types.js +0 -0
- /package/cjs/{number_plus → number}/number_plus.js +0 -0
- /package/esm/{array_plus → array}/array.js +0 -0
- /package/esm/{array_plus → array}/array_plus.js +0 -0
- /package/esm/{array_plus → array}/common_prop_keys.d.ts +0 -0
- /package/esm/{array_plus → array}/common_prop_keys.js +0 -0
- /package/esm/{array_plus → array}/create_tuple.js +0 -0
- /package/esm/{array_plus → array}/drop.js +0 -0
- /package/esm/{array_plus → array}/filter.js +0 -0
- /package/esm/{array_plus → array}/find_first.d.ts +0 -0
- /package/esm/{array_plus → array}/find_first.js +0 -0
- /package/esm/{array_plus → array}/find_last.d.ts +0 -0
- /package/esm/{array_plus → array}/find_last.js +0 -0
- /package/esm/{array_plus → array}/head.d.ts +0 -0
- /package/esm/{array_plus → array}/head.js +0 -0
- /package/esm/{array_plus → array}/intersect_of_props.d.ts +0 -0
- /package/esm/{array_plus → array}/intersect_of_props.js +0 -0
- /package/esm/{array_plus → array}/last.d.ts +0 -0
- /package/esm/{array_plus → array}/last.js +0 -0
- /package/esm/{array_plus → array}/literal_array.d.ts +0 -0
- /package/esm/{array_plus → array}/literal_array.js +0 -0
- /package/esm/{array_plus → array}/pad_left.js +0 -0
- /package/esm/{array_plus → array}/reduce_while.d.ts +0 -0
- /package/esm/{array_plus → array}/reduce_while.js +0 -0
- /package/esm/{array_plus → array}/reverse.d.ts +0 -0
- /package/esm/{array_plus → array}/reverse.js +0 -0
- /package/esm/{array_plus → array}/some.js +0 -0
- /package/esm/{array_plus → array}/tail.d.ts +0 -0
- /package/esm/{array_plus → array}/tail.js +0 -0
- /package/esm/{array_plus → array}/union_of_props.d.ts +0 -0
- /package/esm/{array_plus → array}/union_of_props.js +0 -0
- /package/esm/{array_plus → array}/union_of_values.d.ts +0 -0
- /package/esm/{array_plus → array}/union_of_values.js +0 -0
- /package/esm/{nominal-types → nominal}/types.d.ts +0 -0
- /package/esm/{nominal-types → nominal}/types.js +0 -0
- /package/esm/{number_plus → number}/number_plus.js +0 -0
- /package/ts/{array_plus → array}/common_prop_keys.ts +0 -0
- /package/ts/{array_plus → array}/find_first.ts +0 -0
- /package/ts/{array_plus → array}/find_last.ts +0 -0
- /package/ts/{array_plus → array}/head.ts +0 -0
- /package/ts/{array_plus → array}/intersect_of_props.ts +0 -0
- /package/ts/{array_plus → array}/last.ts +0 -0
- /package/ts/{array_plus → array}/literal_array.ts +0 -0
- /package/ts/{array_plus → array}/reduce_while.ts +0 -0
- /package/ts/{array_plus → array}/reverse.ts +0 -0
- /package/ts/{array_plus → array}/tail.ts +0 -0
- /package/ts/{array_plus → array}/union_of_props.ts +0 -0
- /package/ts/{array_plus → array}/union_of_values.ts +0 -0
- /package/ts/function/{AnyFunction.ts → any_function.ts} +0 -0
- /package/ts/{JSONTypes.ts → json.ts} +0 -0
- /package/ts/{nominal-types → nominal}/types.ts +0 -0
- /package/ts/{UnionKeys.ts → union_keys.ts} +0 -0
- /package/ts/{UnionToIntersection.ts → union_to_intersection.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_type.js","sourceRoot":"","sources":["../../ts/testing/test_type.ts"],"names":[],"mappings":"AAyBA,SAAS,KAAK,CAAC,QAAiB;IAC/B,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB;;;;OAIG;IACH,GAAG,CAAI,QAAkB;QACxB,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,OAAO,CAAI,QAAsB;QAChC,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,KAAK,CAAI,QAAoB;QAC5B,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,IAAI,CAAI,QAAmB;QAC1B,OAAO,QAAa,CAAA;IACrB,CAAC;IACD,KAAK;IACL;;;;OAIG;IACH,SAAS,CAAO,QAAyB;QACxC,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,aAAa,CAAI,QAA4B;QAC5C,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,OAAO,CAAI,QAAsB;QAChC,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,IAAI,CAAI,QAAmB;QAC1B,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,KAAK,CAAI,QAAoB;QAC5B,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,YAAY,CAAI,QAA2B;QAC1C,OAAO,QAAa,CAAA;IACrB,CAAC;IACD;;;;OAIG;IACH,MAAM,CAAI,QAAqB;QAC9B,OAAO,QAAa,CAAA;IACrB,CAAC;CACD,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { IsNever } from '../never/never_type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if `T` is a tuple and not an array.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import type { TupleType } from 'type-plus'
|
|
7
|
+
*
|
|
8
|
+
* type R = TupleType<[]> // []
|
|
9
|
+
* type R = TupleType<[1]> // [1]
|
|
10
|
+
*
|
|
11
|
+
* type R = TupleType<number[]> // never
|
|
12
|
+
* type R = TupleType<string> // never
|
|
13
|
+
* type R = TupleType<never> // never
|
|
14
|
+
* type R = TupleType<unknown> // never
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type TupleType<T, Then = T, Else = never> = IsNever<T, Else, [
|
|
18
|
+
T
|
|
19
|
+
] extends [any[]] ? (number extends T['length'] ? Else : Then) : Else>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if `T` is not a tuple.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import type { NotTupleType } from 'type-plus'
|
|
25
|
+
*
|
|
26
|
+
* type R = NotTupleType<[]> // never
|
|
27
|
+
* type R = NotTupleType<[1]> // never
|
|
28
|
+
*
|
|
29
|
+
* type R = NotTupleType<number[]> // number[]
|
|
30
|
+
* type R = NotTupleType<string> // string
|
|
31
|
+
* type R = NotTupleType<never> // never
|
|
32
|
+
* type R = NotTupleType<unknown> // unknown
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export type NotTupleType<T, Then = T, Else = never> = TupleType<T, Else, Then>;
|
|
36
|
+
/**
|
|
37
|
+
* Is `T` a tuple and not an array.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* import type { IsTuple } from 'type-plus'
|
|
41
|
+
*
|
|
42
|
+
* type R = IsTuple<[]> // true
|
|
43
|
+
*
|
|
44
|
+
* type R = IsTuple<number[]> // false
|
|
45
|
+
* type R = IsTuple<string> // false
|
|
46
|
+
* type R = IsTuple<never> // false
|
|
47
|
+
* type R = IsTuple<unknown> // false
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export type IsTuple<T, Then = true, Else = false> = TupleType<T, Then, Else>;
|
|
51
|
+
/**
|
|
52
|
+
* Is `T` not a tuple.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* import type { IsNotTuple } from 'type-plus'
|
|
56
|
+
*
|
|
57
|
+
* type R = IsNotTuple<[]> // false
|
|
58
|
+
* type R = IsNotTuple<[1]> // false
|
|
59
|
+
*
|
|
60
|
+
* type R = IsNotTuple<number[]> // false
|
|
61
|
+
* type R = IsNotTuple<string> // false
|
|
62
|
+
* type R = IsNotTuple<never> // false
|
|
63
|
+
* type R = IsNotTuple<unknown> // false
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export type IsNotTuple<T, Then = true, Else = false> = TupleType<T, Else, Then>;
|
|
67
|
+
//# sourceMappingURL=tuple_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuple_type.d.ts","sourceRoot":"","sources":["../../ts/tuple/tuple_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CACzD,CAAC,EACD,IAAI,EACJ;IAAC,CAAC;CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,CACvE,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuple_type.js","sourceRoot":"","sources":["../../ts/tuple/tuple_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { IsAny } from '../any/any_type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if the type `T` is exactly `undefined`.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* import type { UndefinedType } from 'type-plus'
|
|
7
|
+
*
|
|
8
|
+
* type R = UndefinedType<undefined> // undefined
|
|
9
|
+
*
|
|
10
|
+
* type R = UndefinedType<never> // never
|
|
11
|
+
* type R = UndefinedType<unknown> // never
|
|
12
|
+
* type R = UndefinedType<string | boolean> // never
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type UndefinedType<T, Then = T, Else = never> = IsAny<T, Else, [
|
|
16
|
+
T,
|
|
17
|
+
undefined
|
|
18
|
+
] extends [undefined, T] ? Then : Else>;
|
|
19
|
+
/**
|
|
20
|
+
* Is the type `T` exactly `undefined`.
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* import type { IsUndefined } from 'type-plus'
|
|
24
|
+
*
|
|
25
|
+
* type R = IsUndefined<undefined> // true
|
|
26
|
+
*
|
|
27
|
+
* type R = IsUndefined<never> // false
|
|
28
|
+
* type R = IsUndefined<unknown> // false
|
|
29
|
+
* type R = IsUndefined<string | boolean> // false
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export type IsUndefined<T, Then = true, Else = false> = UndefinedType<T, Then, Else>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if the type `T` is not `undefined`.
|
|
35
|
+
*
|
|
36
|
+
* ```
|
|
37
|
+
* import type { NotUndefinedType } from 'type-plus'
|
|
38
|
+
*
|
|
39
|
+
* type R = NotUndefinedType<undefined> // never
|
|
40
|
+
*
|
|
41
|
+
* type R = NotUndefinedType<never> // never
|
|
42
|
+
* type R = NotUndefinedType<unknown> // unknown
|
|
43
|
+
* type R = NotUndefinedType<string | boolean> // string | boolean
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export type NotUndefinedType<T, Then = T, Else = never> = UndefinedType<T, Else, Then>;
|
|
47
|
+
/**
|
|
48
|
+
* Is the type `T` not `undefined`.
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* import type { IsNotUndefined } from 'type-plus'
|
|
52
|
+
*
|
|
53
|
+
* type R = IsNotUndefined<undefined> // false
|
|
54
|
+
*
|
|
55
|
+
* type R = IsNotUndefined<never> // true
|
|
56
|
+
* type R = IsNotUndefined<unknown> // true
|
|
57
|
+
* type R = IsNotUndefined<string | boolean> // true
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export type IsNotUndefined<T, Then = true, Else = false> = UndefinedType<T, Else, Then>;
|
|
61
|
+
//# sourceMappingURL=undefined_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undefined_type.d.ts","sourceRoot":"","sources":["../../ts/undefined/undefined_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,KAAK,CAC3D,CAAC,EACD,IAAI,EACJ;IAAC,CAAC;IAAE,SAAS;CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CACnD,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEpF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEtF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undefined_type.js","sourceRoot":"","sources":["../../ts/undefined/undefined_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union_keys.d.ts","sourceRoot":"","sources":["../ts/union_keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union_keys.js","sourceRoot":"","sources":["../ts/union_keys.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union_to_intersection.d.ts","sourceRoot":"","sources":["../ts/union_to_intersection.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GACvG,CAAC,GACD,KAAK,CAAA;AAER,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAElE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union_to_intersection.js","sourceRoot":"","sources":["../ts/union_to_intersection.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,cAAc,CAAI,KAAQ;IACzC,OAAO,KAAsC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { IsAny } from '../any/any_type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if the type `T` is exactly `unknown`.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* import type { UnknownType } from 'type-plus'
|
|
7
|
+
*
|
|
8
|
+
* type R = UnknownType<unknown> // unknown
|
|
9
|
+
*
|
|
10
|
+
* type R = UnknownType<number> // never
|
|
11
|
+
* type R = UnknownType<never> // never
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type UnknownType<T, Then = T, Else = never> = IsAny<T, Else, [
|
|
15
|
+
T,
|
|
16
|
+
unknown
|
|
17
|
+
] extends [unknown, T] ? Then : Else>;
|
|
18
|
+
/**
|
|
19
|
+
* Is the type `T` exactly `unknown`.
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* import type { IsUnknown } from 'type-plus'
|
|
23
|
+
*
|
|
24
|
+
* type R = IsUnknown<unknown> // true
|
|
25
|
+
*
|
|
26
|
+
* type R = IsUnknown<number> // false
|
|
27
|
+
* type R = IsUnknown<never> // false
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type IsUnknown<T, Then = true, Else = false> = UnknownType<T, Then, Else>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the type `T` is not `unknown`.
|
|
33
|
+
*
|
|
34
|
+
* ```
|
|
35
|
+
* import type { NotUnknownType } from 'type-plus'
|
|
36
|
+
*
|
|
37
|
+
* type R = NotUnknownType<unknown> // never
|
|
38
|
+
*
|
|
39
|
+
* type R = NotUnknownType<never> // never
|
|
40
|
+
* type R = NotUnknownType<number> // number
|
|
41
|
+
* type R = NotUnknownType<string | boolean> // string | boolean
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export type NotUnknownType<T, Then = T, Else = never> = UnknownType<T, Else, Then>;
|
|
45
|
+
/**
|
|
46
|
+
* Is the type `T` not exactly `unknown`.
|
|
47
|
+
*
|
|
48
|
+
* ```
|
|
49
|
+
* import type { IsNotUnknown } from 'type-plus'
|
|
50
|
+
*
|
|
51
|
+
* type R = IsNotUnknown<unknown> // false
|
|
52
|
+
*
|
|
53
|
+
* type R = IsNotUnknown<never> // true
|
|
54
|
+
* type R = IsNotUnknown<number> // true
|
|
55
|
+
* type R = IsNotUnknown<string | boolean> // true
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export type IsNotUnknown<T, Then = true, Else = false> = UnknownType<T, Else, Then>;
|
|
59
|
+
//# sourceMappingURL=unknown_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown_type.d.ts","sourceRoot":"","sources":["../../ts/unknown/unknown_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,KAAK,CACzD,CAAC,EACD,IAAI,EACJ;IAAC,CAAC;IAAE,OAAO;CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAC/C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAElF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown_type.js","sourceRoot":"","sources":["../../ts/unknown/unknown_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IsAnyOrNever } from '../any/any_or_never.js';
|
|
2
|
+
import type { IsUndefined } from '../undefined/undefined_type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Check if `T` is `void`.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { VoidType } from 'type-plus'
|
|
8
|
+
*
|
|
9
|
+
* type R = VoidType<void> // void
|
|
10
|
+
*
|
|
11
|
+
* type R = VoidType<1> // never
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type VoidType<T, Then = T, Else = never> = IsAnyOrNever<T, Else, IsUndefined<T, Else, [T] extends [void] ? Then : Else>>;
|
|
15
|
+
/**
|
|
16
|
+
* Check if `T` is not `void`.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import type { VoidType } from 'type-plus'
|
|
20
|
+
*
|
|
21
|
+
* type R = VoidType<void> // never
|
|
22
|
+
*
|
|
23
|
+
* type R = VoidType<1> // 1
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type NotVoidType<T, Then = T, Else = never> = VoidType<T, Else, Then>;
|
|
27
|
+
/**
|
|
28
|
+
* Is `T` `void`.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { IsVoid } from 'type-plus'
|
|
32
|
+
*
|
|
33
|
+
* type R = IsVoid<void> // true
|
|
34
|
+
*
|
|
35
|
+
* type R = IsVoid<1> // false
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export type IsVoid<T, Then = true, Else = false> = VoidType<T, Then, Else>;
|
|
39
|
+
/**
|
|
40
|
+
* Is `T` not `void`.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* import type { IsNotVoid } from 'type-plus'
|
|
44
|
+
*
|
|
45
|
+
* type R = IsNotVoid<void> // false
|
|
46
|
+
*
|
|
47
|
+
* type R = IsNotVoid<1> // true
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export type IsNotVoid<T, Then = true, Else = false> = VoidType<T, Else, Then>;
|
|
51
|
+
//# sourceMappingURL=void_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"void_type.d.ts","sourceRoot":"","sources":["../../ts/void/void_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,YAAY,CAC7D,CAAC,EACD,IAAI,EACJ,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CACtD,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"void_type.js","sourceRoot":"","sources":["../../ts/void/void_type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "type-plus",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Provides additional types for TypeScript.",
|
|
5
5
|
"homepage": "https://github.com/unional/type-plus",
|
|
6
6
|
"bugs": {
|
|
@@ -40,11 +40,10 @@
|
|
|
40
40
|
"@changesets/cli": "^2.25.2",
|
|
41
41
|
"@commitlint/cli": "^17.0.2",
|
|
42
42
|
"@commitlint/config-conventional": "^17.0.2",
|
|
43
|
-
"@jest/globals": "^29.
|
|
44
|
-
"@repobuddy/jest": "^3.
|
|
43
|
+
"@jest/globals": "^29.5.0",
|
|
44
|
+
"@repobuddy/jest": "^3.1.5",
|
|
45
45
|
"@size-limit/esbuild-why": "^8.2.4",
|
|
46
46
|
"@size-limit/preset-small-lib": "^8.2.4",
|
|
47
|
-
"@types/jest": "^29.0.0",
|
|
48
47
|
"@types/node": "^18.0.0",
|
|
49
48
|
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
|
50
49
|
"@typescript-eslint/parser": "^5.48.0",
|
|
@@ -56,40 +55,23 @@
|
|
|
56
55
|
"eslint-config-prettier": "^8.7.0",
|
|
57
56
|
"eslint-plugin-harmony": "^7.1.2",
|
|
58
57
|
"husky": "^8.0.1",
|
|
59
|
-
"jest": "^29.
|
|
58
|
+
"jest": "^29.5.0",
|
|
60
59
|
"jest-watch-suspend": "^1.1.2",
|
|
61
60
|
"jest-watch-toggle-config-2": "^2.1.0",
|
|
62
|
-
"jest-watch-typeahead": "^2.
|
|
61
|
+
"jest-watch-typeahead": "^2.2.2",
|
|
63
62
|
"ncp": "^2.0.0",
|
|
64
63
|
"npm-run-all": "^4.1.5",
|
|
65
64
|
"pinst": "^3.0.0",
|
|
66
65
|
"rimraf": "^3.0.2",
|
|
67
66
|
"satisfier": "^5.2.2",
|
|
68
67
|
"size-limit": "^8.2.4",
|
|
69
|
-
"ts-jest": "^29.
|
|
68
|
+
"ts-jest": "^29.1.0",
|
|
70
69
|
"tslib": "^2.4.0",
|
|
71
70
|
"typedoc": "^0.23.0",
|
|
72
71
|
"typedoc-plugin-extras": "^2.2.3",
|
|
73
72
|
"typescript": "^5.0.2"
|
|
74
73
|
},
|
|
75
|
-
"packageManager": "pnpm@
|
|
76
|
-
"size-limit": [
|
|
77
|
-
{
|
|
78
|
-
"name": "cjs",
|
|
79
|
-
"path": "./cjs/index.js",
|
|
80
|
-
"limit": "15 kb"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"name": "esm",
|
|
84
|
-
"path": "./esm/index.js",
|
|
85
|
-
"limit": "15 kb"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"name": "tslib",
|
|
89
|
-
"path": "./tslib/index.js",
|
|
90
|
-
"limit": "15 kb"
|
|
91
|
-
}
|
|
92
|
-
],
|
|
74
|
+
"packageManager": "pnpm@8.1.0",
|
|
93
75
|
"scripts": {
|
|
94
76
|
"build": "run-p build:cjs build:esm build:tslib",
|
|
95
77
|
"build:cjs": "tsc -p tsconfig.cjs.json && ncp package.cjs.json cjs/package.json",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IsNever } from '../never/never_type.js'
|
|
2
|
+
import type { IsAny } from './any_type.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Is `T` type `any` or `never`.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { IsAnyOrNever } from 'type-plus'
|
|
9
|
+
*
|
|
10
|
+
* type R = IsAnyOrNever<any> // true
|
|
11
|
+
* type R = IsAnyOrNever<never> // true
|
|
12
|
+
*
|
|
13
|
+
* type R = IsAnyOrNever<1> // false
|
|
14
|
+
* type R = IsAnyOrNever<unknown> // false
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Check if the type `T` is exactly `any`.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* import type { AnyType } from 'type-plus'
|
|
7
|
+
*
|
|
8
|
+
* type R = AnyType<any> // any
|
|
9
|
+
*
|
|
10
|
+
* type R = AnyType<never> // never
|
|
11
|
+
* type R = AnyType<unknown> // never
|
|
12
|
+
* type R = AnyType<string | boolean> // never
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type AnyType<T, Then = T, Else = never> = 0 extends 1 & T ? Then : Else
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Is the type `T` exactly `any`.
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* import type { IsAny } from 'type-plus'
|
|
22
|
+
*
|
|
23
|
+
* type R = IsAny<any> // true
|
|
24
|
+
*
|
|
25
|
+
* type R = IsAny<never> // false
|
|
26
|
+
* type R = IsAny<unknown> // false
|
|
27
|
+
* type R = IsAny<string | boolean> // false
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type IsAny<T, Then = true, Else = false> = AnyType<T, Then, Else>
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check if the type `T` is not `any`.
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* import type { NotAnyType } from 'type-plus'
|
|
37
|
+
*
|
|
38
|
+
* type R = NotAnyType<any> // never
|
|
39
|
+
*
|
|
40
|
+
* type R = NotAnyType<never> // never
|
|
41
|
+
* type R = NotAnyType<unknown> // unknown
|
|
42
|
+
* type R = NotAnyType<string | boolean> // string | boolean
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export type NotAnyType<T, Then = T, Else = never> = AnyType<T, Else, Then>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Is the type `T` not `any`.
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* import type { IsNotAny } from 'type-plus'
|
|
52
|
+
*
|
|
53
|
+
* type R = IsNotAny<any> // false
|
|
54
|
+
*
|
|
55
|
+
* type R = IsNotAny<never> // true
|
|
56
|
+
* type R = IsNotAny<unknown> // true
|
|
57
|
+
* type R = IsNotAny<string | boolean> // true
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export type IsNotAny<T, Then = true, Else = false> = AnyType<T, Else, Then>
|
package/ts/any/readme.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Any
|
|
2
|
+
|
|
3
|
+
`any` is one of the two top type in TypeScript. It is the supertype of all types. It is a way to opt-out of type checking and let the values pass through compile-time checks.
|
|
4
|
+
|
|
5
|
+
## Type Checking
|
|
6
|
+
|
|
7
|
+
The `AnyType<T>` and friends are used to check if a type is `any` or not.
|
|
8
|
+
|
|
9
|
+
They are strict type checks, meaning they match only the type `any`.
|
|
10
|
+
Union and intersections are not a factor here they are resolved to `any`,
|
|
11
|
+
except `any & never` which is `never`.
|
|
12
|
+
|
|
13
|
+
- [`AnyType<T, Then = T, Else = never>`](any_type.ts#L15): check if `T` is exactly `any`.
|
|
14
|
+
- [`IsAny<T, Then = true, Else = false`](any_type.ts#L30): is `T` exactly `any`.
|
|
15
|
+
- [`NotAnyType<T, Then = T, Else = never>`](any_type.ts#L45): check if `T` is not exactly `any`.
|
|
16
|
+
- [`IsNotAny<T, Then = true, Else = false>`](any_type.ts#L60): is `T` not exactly `any`.
|
|
17
|
+
|
|
18
|
+
## Type Utilities
|
|
19
|
+
|
|
20
|
+
- [`IsAnyOrNever<T, Then = true, Else = false>`](any_or_never.ts#L17)]: is `T` type `any` or `never`.
|
|
21
|
+
|
|
22
|
+
## References
|
|
23
|
+
|
|
24
|
+
- [handbook]
|
|
25
|
+
|
|
26
|
+
[handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IndexAt } from './array_index.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gets the type of the array or tuple at index `N`.
|
|
5
|
+
*
|
|
6
|
+
* Like `Array.at()`, this type supports negative numbers.
|
|
7
|
+
*
|
|
8
|
+
* @alias ArrayPlus.At
|
|
9
|
+
* @see https://github.com/microsoft/TypeScript/issues/53345#issuecomment-1477138167
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import type { At } from 'type-plus'
|
|
13
|
+
*
|
|
14
|
+
* type R = At<[1, 2, 3], 2> // 3
|
|
15
|
+
* type R = At<[1, 2, 3], -1> // 3
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type At<A extends unknown[], N extends number, Fail = never> = IndexAt<A, N, Fail> extends infer I
|
|
19
|
+
? I extends number
|
|
20
|
+
? A[I]
|
|
21
|
+
: Fail
|
|
22
|
+
: never
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Concats two arrays.
|
|
26
|
+
*
|
|
27
|
+
* alias of: `[...A, ...B]`
|
|
28
|
+
*
|
|
29
|
+
* @alias ArrayPlus.Concat
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* import type { Concat } form 'type-plus'
|
|
33
|
+
*
|
|
34
|
+
* type R = Concat<[1], [2, 3]> // [1, 2, 3]
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export type Concat<A extends unknown[], B extends unknown[]> = [...A, ...B]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IsAny } from '../any/any_type.js'
|
|
2
|
+
import type { Equal } from '../equal/equal.js'
|
|
3
|
+
import type { Abs } from '../math/Abs.js'
|
|
4
|
+
import type { GreaterThan } from '../math/GreaterThan.js'
|
|
5
|
+
import type { Subtract } from '../math/Subtract.js'
|
|
6
|
+
import type { IsNever } from '../never/never_type.js'
|
|
7
|
+
import type { Integer } from '../number/integer.js'
|
|
8
|
+
import type { Negative } from '../number/negative.js'
|
|
9
|
+
import type { StrictNumberType } from '../number/strict_number_type.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Gets the normalized index to access the element of an array or tuple.
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* import type { ArrayPlus } from 'type-plus'
|
|
16
|
+
*
|
|
17
|
+
* type R = ArrayPlus.IndexAt<['a', 'b', 'c'], 2> // 2
|
|
18
|
+
* type R = ArrayPlus.IndexAt<['a', 'b', 'c'], -2> // 1
|
|
19
|
+
*
|
|
20
|
+
* type R = ArrayPlus.IndexAt<['a', 'b', 'c'], 3> // never
|
|
21
|
+
* type R = ArrayPlus.IndexAt<['a', 'b', 'c'], -4> // never
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type IndexAt<A extends Array<unknown>, N extends number, Fail = never> = Equal<
|
|
25
|
+
A['length'],
|
|
26
|
+
0,
|
|
27
|
+
Fail,
|
|
28
|
+
Integer<
|
|
29
|
+
N,
|
|
30
|
+
StrictNumberType<
|
|
31
|
+
A['length'],
|
|
32
|
+
// A: array
|
|
33
|
+
N,
|
|
34
|
+
// A: tuple
|
|
35
|
+
Negative<
|
|
36
|
+
N,
|
|
37
|
+
GreaterThan<Abs<N>, A['length']> extends true ? Fail : Subtract<A['length'], Abs<N>>,
|
|
38
|
+
GreaterThan<A['length'], N> extends true ? N : Fail
|
|
39
|
+
>
|
|
40
|
+
>,
|
|
41
|
+
// N: number or float
|
|
42
|
+
IsAny<
|
|
43
|
+
N,
|
|
44
|
+
number,
|
|
45
|
+
StrictNumberType<
|
|
46
|
+
N,
|
|
47
|
+
// TODO: handle tuple to union of indexes
|
|
48
|
+
N
|
|
49
|
+
>
|
|
50
|
+
>
|
|
51
|
+
>
|
|
52
|
+
>
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Is N an out of bound index of A.
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
58
|
+
* import { IsIndexOutOfBound } from 'type-plus'
|
|
59
|
+
*
|
|
60
|
+
* type R = IsIndexOutOfBound<[1], 0> // false
|
|
61
|
+
* type R = IsIndexOutOfBound<[1], -1> // false
|
|
62
|
+
|
|
63
|
+
* type R = IsIndexOutOfBound<[1], 1> // true
|
|
64
|
+
* type R = IsIndexOutOfBound<[1], -2> // true
|
|
65
|
+
*/
|
|
66
|
+
export type IsIndexOutOfBound<A extends unknown[], N extends number, Then = true, Else = false> = IsNever<
|
|
67
|
+
IndexAt<A, N>,
|
|
68
|
+
Then,
|
|
69
|
+
Else
|
|
70
|
+
>
|