type-plus 6.2.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 +40 -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 -14
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +11 -14
- 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 -14
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -11
- 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 -18
- 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 +27 -0
- 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 -19
- 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/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 -19
- 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/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 -24
- package/ts/testing/index.ts +0 -1
- /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,61 @@
|
|
|
1
|
+
import type { IsNever } from '../never/never_type.js'
|
|
2
|
+
import type { StrictNumberType } from '../number/strict_number_type.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Check if the type `T` is an array and not a tuple.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { ArrayType } from 'type-plus'
|
|
9
|
+
*
|
|
10
|
+
* type R = ArrayType<number[]> // number[]
|
|
11
|
+
*
|
|
12
|
+
* type R = ArrayType<[1]> // never
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type ArrayType<T, Then = T, Else = never> = IsNever<
|
|
16
|
+
T,
|
|
17
|
+
Else,
|
|
18
|
+
[any[]] extends [T] ? ([T] extends [any[]] ? StrictNumberType<T['length'], Then, Else> : Else) : Else
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Check if the type `T` is not an array.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import type { NotArrayType } from 'type-plus'
|
|
26
|
+
*
|
|
27
|
+
* type R = NotArrayType<number[]> // never
|
|
28
|
+
*
|
|
29
|
+
* type R = NotArrayType<number> // number
|
|
30
|
+
* type R = NotArrayType<[1]> // [1]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export type NotArrayType<T, Then = T, Else = never> = ArrayType<T, Else, Then>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Is `T` an array?
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import type { IsArray } from 'type-plus'
|
|
40
|
+
*
|
|
41
|
+
* type R = IsArray<number[]> // true
|
|
42
|
+
*
|
|
43
|
+
* type R = IsArray<number> // false
|
|
44
|
+
* type R = IsArray<[1]> // false
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export type IsArray<T, Then = true, Else = false> = ArrayType<T, Then, Else>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Is `T` not an array?
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* import type { IsNotArray } from 'type-plus'
|
|
54
|
+
*
|
|
55
|
+
* type R = IsNotArray<number[]> // false
|
|
56
|
+
*
|
|
57
|
+
* type R = IsNotArray<number> // true
|
|
58
|
+
* type R = IsNotArray<[1]> // true
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export type IsNotArray<T, Then = true, Else = false> = ArrayType<T, Else, Then>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DigitArray } from '../math/index.js'
|
|
2
|
+
import type { IsInteger } from '../number/integer.js'
|
|
3
|
+
import type { IsPositive } from '../number/positive.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates `Tuple<T>` with `L` number of elements.
|
|
7
|
+
* @note Other cool implementations by @lazytype, @jcalz:
|
|
8
|
+
* @see https://github.com/microsoft/TypeScript/issues/26223#issuecomment-674514787
|
|
9
|
+
* @see https://github.com/microsoft/TypeScript/issues/47874#issuecomment-1039157322
|
|
10
|
+
*/
|
|
11
|
+
export type CreateTuple<L extends number, T = unknown, Fail = never> = number extends L
|
|
12
|
+
? T[]
|
|
13
|
+
: IsPositive<L> extends true
|
|
14
|
+
? IsInteger<L> extends true
|
|
15
|
+
? DigitArray.ToTuple<[], DigitArray.FromNumber<L>, T>
|
|
16
|
+
: Fail
|
|
17
|
+
: Fail
|
package/ts/array/drop.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Equal } from '../equal/equal.js'
|
|
2
|
+
import type { NonNull, NonUndefined } from '../utils/index.js'
|
|
3
|
+
|
|
4
|
+
export type DropFirst<A extends any[]> = number extends A['length']
|
|
5
|
+
? A
|
|
6
|
+
: A['length'] extends 0
|
|
7
|
+
? never[]
|
|
8
|
+
: A['length'] extends 1
|
|
9
|
+
? never[]
|
|
10
|
+
: A extends [any, ...infer Tail]
|
|
11
|
+
? Tail
|
|
12
|
+
: never
|
|
13
|
+
|
|
14
|
+
export type DropLast<A extends any[]> = number extends A['length']
|
|
15
|
+
? A
|
|
16
|
+
: A['length'] extends 0
|
|
17
|
+
? never[]
|
|
18
|
+
: A['length'] extends 1
|
|
19
|
+
? never[]
|
|
20
|
+
: A extends [...infer Heads, any]
|
|
21
|
+
? Heads
|
|
22
|
+
: never
|
|
23
|
+
|
|
24
|
+
type ExcludeUnionOfEmptyTuple<A> = Equal<A, []> extends true ? A : Exclude<A, []>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* drops entries matching `Criteria` in array or tuple `A`.
|
|
28
|
+
*/
|
|
29
|
+
export type DropMatch<A extends Readonly<Array<any>>, Criteria> = number extends A['length']
|
|
30
|
+
? // array
|
|
31
|
+
A[0] extends Criteria
|
|
32
|
+
? // criteria matches: DropAll<string[], string>
|
|
33
|
+
never[]
|
|
34
|
+
: undefined extends Criteria
|
|
35
|
+
? null extends Criteria
|
|
36
|
+
? Array<NonNullable<A[0]>>
|
|
37
|
+
: Array<NonUndefined<A[0]>>
|
|
38
|
+
: null extends Criteria
|
|
39
|
+
? Array<NonNull<A[0]>>
|
|
40
|
+
: Criteria extends A[0]
|
|
41
|
+
? Array<Exclude<A[0], Criteria>>
|
|
42
|
+
: A[0] extends Criteria
|
|
43
|
+
? A
|
|
44
|
+
: Array<Exclude<A[0], Criteria>>
|
|
45
|
+
: DropMatchTuple<A, Criteria>
|
|
46
|
+
|
|
47
|
+
type DropMatchTuple<A extends Readonly<Array<any>>, Criteria> = A['length'] extends 0
|
|
48
|
+
? // empty tuple
|
|
49
|
+
A
|
|
50
|
+
: A extends readonly [infer Head, ...infer Tail]
|
|
51
|
+
? Tail['length'] extends 0
|
|
52
|
+
? // single element tuple
|
|
53
|
+
undefined extends Criteria
|
|
54
|
+
? ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]>
|
|
55
|
+
: ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]>
|
|
56
|
+
: // multiple elements
|
|
57
|
+
Exclude<Head, Criteria> extends never
|
|
58
|
+
? DropMatch<Tail, Criteria>
|
|
59
|
+
: [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>]
|
|
60
|
+
: never[]
|
|
61
|
+
|
|
62
|
+
export type DropNull<A extends Array<any>> = DropMatch<A, null>
|
|
63
|
+
export type DropNullable<A extends Array<any>> = DropMatch<A, null | undefined>
|
|
64
|
+
export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* drop a particular value from an array
|
|
68
|
+
*/
|
|
69
|
+
export function drop<A extends Readonly<Array<any>>, C>(array: A, value: C): DropMatch<A, C> {
|
|
70
|
+
return array.filter(v => v !== value) as DropMatch<A, C>
|
|
71
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* filter the array or tuple `A`, keeping entries satisfying `Criteria`.
|
|
3
|
+
*/
|
|
4
|
+
export type Filter<A extends Array<any>, Criteria> = number extends A['length']
|
|
5
|
+
? // array
|
|
6
|
+
A[0] extends Criteria
|
|
7
|
+
? A
|
|
8
|
+
: Criteria extends A[0]
|
|
9
|
+
? Array<Criteria>
|
|
10
|
+
: never[]
|
|
11
|
+
: // tuple
|
|
12
|
+
A['length'] extends 0
|
|
13
|
+
? never
|
|
14
|
+
: A extends [infer Head, ...infer Tail]
|
|
15
|
+
? Tail['length'] extends 0
|
|
16
|
+
? Head extends Criteria
|
|
17
|
+
? [Head]
|
|
18
|
+
: never[]
|
|
19
|
+
: Head extends Criteria
|
|
20
|
+
? [Head, ...Filter<Tail, Criteria>]
|
|
21
|
+
: Filter<Tail, Criteria>
|
|
22
|
+
: never
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* keeps entries satisfying `Criteria` in array or tuple `A`.
|
|
26
|
+
*/
|
|
27
|
+
export type KeepMatch<A extends Array<any>, Criteria> = Filter<A, Criteria>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './common_prop_keys.js'
|
|
2
|
+
export * from './create_tuple.js'
|
|
3
|
+
export * from './drop.js'
|
|
4
|
+
export * from './filter.js'
|
|
5
|
+
export * from './find_first.js'
|
|
6
|
+
export * from './find_last.js'
|
|
7
|
+
export * from './head.js'
|
|
8
|
+
export * from './intersect_of_props.js'
|
|
9
|
+
export * from './last.js'
|
|
10
|
+
export * from './literal_array.js'
|
|
11
|
+
export * from './pad_left.js'
|
|
12
|
+
export * from './reduce_while.js'
|
|
13
|
+
export * from './reverse.js'
|
|
14
|
+
export * from './some.js'
|
|
15
|
+
export * from './tail.js'
|
|
16
|
+
export * from './union_of_props.js'
|
|
17
|
+
export * from './union_of_values.js'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IsAny } from '../any/any_type.js'
|
|
2
|
+
import type { Equal } from '../equal/equal.js'
|
|
3
|
+
import type { CreateTuple } from './create_tuple.js'
|
|
4
|
+
import type { UnionOfValues } from './union_of_values.js'
|
|
5
|
+
|
|
6
|
+
export type PadLeft<A extends any[], Total extends number, PadWith = any> = number extends A['length']
|
|
7
|
+
? IsAny<UnionOfValues<A>> extends true
|
|
8
|
+
? A
|
|
9
|
+
: Equal<UnionOfValues<A>, PadWith> extends true
|
|
10
|
+
? A
|
|
11
|
+
: PadLeft<[...CreateTuple<Total, PadWith>, ...A], Total, PadWith>
|
|
12
|
+
: CreateTuple<Total, any> extends [...infer U, ...A]
|
|
13
|
+
? number extends U['length']
|
|
14
|
+
? A
|
|
15
|
+
: [...CreateTuple<U['length'], PadWith>, ...A]
|
|
16
|
+
: A
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Array
|
|
2
|
+
|
|
3
|
+
`Array<T>` or `T[]` is a type that represents an array of `T`.
|
|
4
|
+
|
|
5
|
+
## Type Checking
|
|
6
|
+
|
|
7
|
+
The `ArrayType<T>` and friends are used to check if a type is exactly `Array<T>` or not.
|
|
8
|
+
|
|
9
|
+
They are strict type checks, meaning they match only the type `Array<T>`,
|
|
10
|
+
and not [tuple], union, or intersection types.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import type { ArrayType } from 'type-plus'
|
|
14
|
+
|
|
15
|
+
type R = ArrayType<number[]> // number[]
|
|
16
|
+
|
|
17
|
+
type R = ArrayType<[1]> // never
|
|
18
|
+
type R = ArrayType<number[] | 1> // never
|
|
19
|
+
type R = ArrayType<number[] & { a: 1 }> // never
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- [`ArrayType<T, Then = T, Else = never>`](array_type.ts#L15): check if `T` is exactly `Array<X>`.
|
|
23
|
+
- [`IsArray<T, Then = true, Else = false`](array_type.ts#L33): is `T` exactly `Array<X>`.
|
|
24
|
+
- [`NotArrayType<T, Then = T, Else = never>`](array_type.ts#L47): check if `T` is not exactly `Array<X>`.
|
|
25
|
+
- [`IsNotArray<T, Then = true, Else = false>`](array_type.ts#L61): is `T` not exactly `Array<X>`.
|
|
26
|
+
|
|
27
|
+
## References
|
|
28
|
+
|
|
29
|
+
- [handbook]
|
|
30
|
+
|
|
31
|
+
[handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays
|
|
32
|
+
[tuple]: ../tuple/readme.md
|
package/ts/array/some.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Equal } from '../equal/equal.js'
|
|
2
|
+
import type { Tail } from './tail.js'
|
|
3
|
+
import type { UnionOfValues } from './union_of_values.js'
|
|
4
|
+
|
|
5
|
+
export type Some<
|
|
6
|
+
A extends any[],
|
|
7
|
+
Criteria,
|
|
8
|
+
Mode extends 'strict' | 'loose' = 'loose',
|
|
9
|
+
Then = true,
|
|
10
|
+
Else = false
|
|
11
|
+
> = Mode extends 'strict'
|
|
12
|
+
? Some.Strict<A, Criteria, Then, Else>
|
|
13
|
+
: number extends A['length']
|
|
14
|
+
? UnionOfValues<A> extends Criteria
|
|
15
|
+
? Then
|
|
16
|
+
: Else
|
|
17
|
+
: A['length'] extends 0
|
|
18
|
+
? Else
|
|
19
|
+
: A[0] extends Criteria
|
|
20
|
+
? Then
|
|
21
|
+
: Some<Tail<A>, Criteria, 'loose', Then, Else>
|
|
22
|
+
|
|
23
|
+
export namespace Some {
|
|
24
|
+
export type Strict<A extends any[], Criteria, Then, Else> = number extends A['length']
|
|
25
|
+
? Equal<UnionOfValues<A>, Criteria> extends true
|
|
26
|
+
? Then
|
|
27
|
+
: Else
|
|
28
|
+
: A['length'] extends 0
|
|
29
|
+
? Else
|
|
30
|
+
: Equal<A[0], Criteria> extends true
|
|
31
|
+
? Then
|
|
32
|
+
: Strict<Tail<A>, Criteria, Then, Else>
|
|
33
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { tersify } from 'tersify'
|
|
2
|
+
import { isConstructor, type AnyConstructor } from '../class/index.js'
|
|
3
|
+
import { AnyFunction } from '../function/any_function.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* assert the subject satisfies the specified type T
|
|
7
|
+
* @type T the type to check against.
|
|
8
|
+
*/
|
|
9
|
+
export function assertType<T>(subject: T): asserts subject is T
|
|
10
|
+
export function assertType<T>(subject: unknown, validator: (s: T) => boolean): asserts subject is T
|
|
11
|
+
export function assertType<T extends new (...args: any) => any>(
|
|
12
|
+
subject: unknown,
|
|
13
|
+
constructor: T
|
|
14
|
+
): asserts subject is InstanceType<T>
|
|
15
|
+
export function assertType(subject: unknown, validator?: (s: any) => boolean) {
|
|
16
|
+
if (validator) {
|
|
17
|
+
if ((isConstructor(validator) && !(subject instanceof validator)) || !validator(subject))
|
|
18
|
+
throw new TypeError(`subject fails to satisfy ${tersify(validator)}`)
|
|
19
|
+
}
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
assertType.isUndefined = function (subject: undefined): asserts subject is undefined {
|
|
24
|
+
if (typeof subject !== 'undefined') throw TypeError(`subject is not undefined`)
|
|
25
|
+
}
|
|
26
|
+
assertType.noUndefined = function <S>(subject: Exclude<S, undefined>): void {
|
|
27
|
+
if (typeof subject === 'undefined') throw TypeError(`subject is undefined`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
assertType.isNull = function (subject: null): asserts subject is null {
|
|
31
|
+
if (subject !== null) throw TypeError(`subject is not null`)
|
|
32
|
+
}
|
|
33
|
+
assertType.noNull = function <S>(subject: Exclude<S, null>): void {
|
|
34
|
+
if (subject === null) throw TypeError(`subject is null`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
assertType.isNumber = function (subject: number): asserts subject is number {
|
|
38
|
+
if (typeof subject !== 'number') throw TypeError(`subject is not number`)
|
|
39
|
+
}
|
|
40
|
+
assertType.noNumber = function <S>(subject: Exclude<S, number>): void {
|
|
41
|
+
if (typeof subject === 'number') throw TypeError(`subject is number`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
assertType.isBoolean = function (subject: boolean): asserts subject is boolean {
|
|
45
|
+
if (typeof subject !== 'boolean') throw TypeError(`subject is not boolean`)
|
|
46
|
+
}
|
|
47
|
+
assertType.noBoolean = function <S>(subject: Exclude<S, boolean>): void {
|
|
48
|
+
if (typeof subject === 'boolean') throw TypeError(`subject is boolean`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
assertType.isTrue = function (subject: true): asserts subject is true {
|
|
52
|
+
if (subject !== true) throw TypeError(`subject is not true`)
|
|
53
|
+
}
|
|
54
|
+
assertType.noTrue = function <S>(subject: Exclude<S, true>): void {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
if (subject === true) throw TypeError(`subject is true`)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
assertType.isFalse = function (subject: false): asserts subject is false {
|
|
60
|
+
if (subject !== false) throw TypeError(`subject is not false`)
|
|
61
|
+
}
|
|
62
|
+
assertType.noFalse = function <S>(subject: Exclude<S, false>): void {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
if (subject === false) throw TypeError(`subject is false`)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
assertType.isString = function (subject: string): asserts subject is string {
|
|
68
|
+
if (typeof subject !== 'string') throw TypeError(`subject is not string`)
|
|
69
|
+
}
|
|
70
|
+
assertType.noString = function <S>(subject: Exclude<S, string>): void {
|
|
71
|
+
if (typeof subject === 'string') throw TypeError(`subject is string`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
assertType.isFunction = function (subject: AnyFunction): asserts subject is AnyFunction {
|
|
75
|
+
if (typeof subject !== 'function') throw TypeError(`subject is not function`)
|
|
76
|
+
}
|
|
77
|
+
assertType.noFunction = function <S>(subject: Exclude<S, AnyFunction>): void {
|
|
78
|
+
if (typeof subject === 'function') throw TypeError(`subject is function`)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
assertType.isConstructor = function (subject: AnyConstructor): asserts subject is AnyConstructor {
|
|
82
|
+
if (!isConstructor(subject)) throw TypeError(`subject is not a constructor`)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
assertType.isError = function (subject: Error): asserts subject is Error {
|
|
86
|
+
if (!(subject instanceof Error)) throw TypeError(`subject is not an Error`)
|
|
87
|
+
}
|
|
88
|
+
assertType.noError = function <S>(subject: Exclude<S, Error>): void {
|
|
89
|
+
if (subject instanceof Error) throw TypeError(`subject is an Error`)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
assertType.isNever = function (subject: never): asserts subject is never {}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* creates a custom assertion function with standard TypeError.
|
|
96
|
+
* Currently this requires explicity type annotation,
|
|
97
|
+
* thus making it hard to use:
|
|
98
|
+
* https://github.com/microsoft/TypeScript/issues/41047
|
|
99
|
+
*/
|
|
100
|
+
assertType.custom = function <T>(validator: (s: T) => boolean): (subject: unknown) => asserts subject is T {
|
|
101
|
+
return function (subject) {
|
|
102
|
+
if (!validator(subject as any)) throw new TypeError(`subject fails to satisfy ${tersify(validator)}`)
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
assertType.as = function <T>(subject: unknown): asserts subject is T {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Assertion Functions
|
|
2
|
+
|
|
3
|
+
[Assertion Functions][assertion_functions] are special functions that asserts certain conditions of your program.
|
|
4
|
+
|
|
5
|
+
They throw an error if the condition is not met, and return nothing otherwise.
|
|
6
|
+
|
|
7
|
+
These assertion functions are typically used in runtime,
|
|
8
|
+
so that that type of the value can be narrowed down.
|
|
9
|
+
|
|
10
|
+
## References
|
|
11
|
+
|
|
12
|
+
- [Handbook][assertion_functions]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
[assertion_functions]: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IsAnyOrNever } from '../any/any_or_never.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the type `T` is exactly `bigint`.
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* import type { BigintType } from 'type-plus'
|
|
8
|
+
*
|
|
9
|
+
* type R = BigintType<bigint> // bigint
|
|
10
|
+
*
|
|
11
|
+
* type R = BigintType<1n> // never
|
|
12
|
+
* type R = BigintType<number> // never
|
|
13
|
+
* type R = BigintType<bigint | boolean> // never
|
|
14
|
+
* type R = BigintType<unknown> // never
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type BigintType<T, Then = T, Else = never> = IsAnyOrNever<T, Else, [T] extends [bigint] ? Then : Else>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Is the type `T` exactly `bigint`.
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* import type { IsBigint } from 'type-plus'
|
|
24
|
+
*
|
|
25
|
+
* type R = IsBigint<bigint> // true
|
|
26
|
+
*
|
|
27
|
+
* type R = IsBigint<1n> // false
|
|
28
|
+
* type R = IsBigint<number> // false
|
|
29
|
+
* type R = IsBigint<bigint | boolean> // false
|
|
30
|
+
* type R = IsBigint<unknown> // false
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export type IsBigint<T, Then = true, Else = false> = BigintType<T, Then, Else>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check if the type `T` is not exactly `null`.
|
|
37
|
+
*
|
|
38
|
+
* ```
|
|
39
|
+
* import type { NotBigintType } from 'type-plus'
|
|
40
|
+
*
|
|
41
|
+
* type R = NotBigintType<bigint> // never
|
|
42
|
+
*
|
|
43
|
+
* type R = NotBigintType<1n> // 1n
|
|
44
|
+
* type R = NotBigintType<number> // number
|
|
45
|
+
* type R = NotBigintType<bigint | boolean> // string | boolean
|
|
46
|
+
* type R = NotBigintType<unknown> // unknown
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export type NotBigintType<T, Then = T, Else = never> = BigintType<T, Else, Then>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Is the type `T` not exactly `null`.
|
|
53
|
+
*
|
|
54
|
+
* ```
|
|
55
|
+
* import type { IsNotBigint } from 'type-plus'
|
|
56
|
+
*
|
|
57
|
+
* type R = IsNotBigint<bigint> // false
|
|
58
|
+
*
|
|
59
|
+
* type R = IsNotBigint<1n> // true
|
|
60
|
+
* type R = IsNotBigint<number> // true
|
|
61
|
+
* type R = IsNotBigint<bigint | boolean> // true
|
|
62
|
+
* type R = IsNotBigint<unknown> // true
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export type IsNotBigint<T, Then = true, Else = false> = BigintType<T, Else, Then>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# bigint
|
|
2
|
+
|
|
3
|
+
`bigint` is a type to represent integers that are too large to be represented by a `number`.
|
|
4
|
+
|
|
5
|
+
## Type Checking
|
|
6
|
+
|
|
7
|
+
The `BigIntType<T>` and friends are used to check if a type is `bigint` or not.
|
|
8
|
+
|
|
9
|
+
They are loose type checks, meaning they match `bigint` and bigint literals,
|
|
10
|
+
as well as intersection types.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import type { BigIntType } from 'type-plus'
|
|
14
|
+
|
|
15
|
+
type R = BigIntType<bigint> // bigint
|
|
16
|
+
|
|
17
|
+
type R = BigIntType<1n> // bigint
|
|
18
|
+
type R = BigIntType<bigint & { a: 1}> // bigint
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- [`BigIntType<T, Then = T, Else = never>`](bigint_type.ts#L15): check if `T` is `bigint` or bigint literal.
|
|
22
|
+
- [`IsBigInt<T, Then = true, Else = false`](bigint_type.ts#L33): is `T` `bigint`.
|
|
23
|
+
- [`NotBigIntType<T, Then = T, Else = never>`](bigint_type.ts#L47): check if `T` is not `bigint`.
|
|
24
|
+
- [`IsNotBigInt<T, Then = true, Else = false>`](bigint_type.ts#L61): is `T` not `bigint`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
The `StrictBigIntType<T>` and friends are used to check if a type is exactly `bigint` or not.
|
|
29
|
+
|
|
30
|
+
They are strict type checks, meaning they match only the type `bigint`,
|
|
31
|
+
and not bigint literals or intersection types.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import type { StrictBigIntType } from 'type-plus'
|
|
35
|
+
|
|
36
|
+
type R = StrictBigIntType<bigint> // bigint
|
|
37
|
+
|
|
38
|
+
type R = StrictBigIntType<1n> // never
|
|
39
|
+
type R = StrictBigIntType<bigint & { a: 1}> // never
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- [`StrictBigIntType<T, Then = T, Else = never>`](strict_bigint_type.ts#L15): check if `T` is exactly `bigint`.
|
|
43
|
+
- [`IsStrictBigInt<T, Then = true, Else = false`](strict_bigint_type.ts#L33): is `T` exactly `bigint`.
|
|
44
|
+
- [`NotStrictBigIntType<T, Then = T, Else = never>`](strict_bigint_type.ts#L47): check if `T` is not exactly `bigint`.
|
|
45
|
+
- [`IsNotStrictBigInt<T, Then = true, Else = false>`](strict_bigint_type.ts#L61): is `T` not exactly `bigint`.
|
|
46
|
+
|
|
47
|
+
## References
|
|
48
|
+
|
|
49
|
+
- [mdn web docs: BigInt][mdn]
|
|
50
|
+
|
|
51
|
+
[mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IsAnyOrNever } from '../any/any_or_never.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the type `T` is exactly `bigint`.
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* import type { StrictBigintType } from 'type-plus'
|
|
8
|
+
*
|
|
9
|
+
* type R = StrictBigintType<bigint> // bigint
|
|
10
|
+
*
|
|
11
|
+
* type R = StrictBigintType<1n> // never
|
|
12
|
+
* type R = StrictBigintType<number> // never
|
|
13
|
+
* type R = StrictBigintType<bigint | boolean> // never
|
|
14
|
+
* type R = StrictBigintType<unknown> // never
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type StrictBigintType<T, Then = T, Else = never> = IsAnyOrNever<
|
|
18
|
+
T,
|
|
19
|
+
Else,
|
|
20
|
+
[bigint] extends [T] ? ([T] extends [bigint] ? (`${T}` extends `${number}` ? Else : Then) : Else) : Else
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Is the type `T` exactly `bigint`.
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
* import type { IsStrictBigint } from 'type-plus'
|
|
28
|
+
*
|
|
29
|
+
* type R = IsStrictBigint<bigint> // true
|
|
30
|
+
*
|
|
31
|
+
* type R = IsStrictBigint<1n> // false
|
|
32
|
+
* type R = IsStrictBigint<number> // false
|
|
33
|
+
* type R = IsStrictBigint<bigint | boolean> // false
|
|
34
|
+
* type R = IsStrictBigint<unknown> // false
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export type IsStrictBigint<T, Then = true, Else = false> = StrictBigintType<T, Then, Else>
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if the type `T` is not exactly `bigint`.
|
|
41
|
+
*
|
|
42
|
+
* ```
|
|
43
|
+
* import type { NotStrictBigintType } from 'type-plus'
|
|
44
|
+
*
|
|
45
|
+
* type R = NotStrictBigintType<bigint> // never
|
|
46
|
+
*
|
|
47
|
+
* type R = NotStrictBigintType<1n> // 1n
|
|
48
|
+
* type R = NotStrictBigintType<number> // number
|
|
49
|
+
* type R = NotStrictBigintType<bigint | boolean> // string | boolean
|
|
50
|
+
* type R = NotStrictBigintType<unknown> // unknown
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export type NotStrictBigintType<T, Then = T, Else = never> = StrictBigintType<T, Else, Then>
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Is the type `T` not exactly `bigint`.
|
|
57
|
+
*
|
|
58
|
+
* ```
|
|
59
|
+
* import type { IsNotStrictBigint } from 'type-plus'
|
|
60
|
+
*
|
|
61
|
+
* type R = IsNotStrictBigint<bigint> // false
|
|
62
|
+
*
|
|
63
|
+
* type R = IsNotStrictBigint<1n> // true
|
|
64
|
+
* type R = IsNotStrictBigint<number> // true
|
|
65
|
+
* type R = IsNotStrictBigint<bigint | boolean> // true
|
|
66
|
+
* type R = IsNotStrictBigint<unknown> // true
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export type IsNotStrictBigint<T, Then = true, Else = false> = StrictBigintType<T, Else, Then>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IsAnyOrNever } from '../any/any_or_never.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the type `T` is `boolean`, including `true` and `false`.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { BooleanType } from 'type-plus'
|
|
8
|
+
*
|
|
9
|
+
* type R = BooleanType<boolean> // boolean
|
|
10
|
+
* type R = BooleanType<true> // true
|
|
11
|
+
* type R = BooleanType<false> // false
|
|
12
|
+
*
|
|
13
|
+
* type R = BooleanType<number> // never
|
|
14
|
+
* type R = BooleanType<unknown> // never
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type BooleanType<T, Then = T, Else = never> = IsAnyOrNever<
|
|
18
|
+
T,
|
|
19
|
+
Else,
|
|
20
|
+
[T] extends [boolean] ? Then : Else
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Check if the type `T` is not `boolean`, including `true` and `false`.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import type { NotBooleanType } from 'type-plus'
|
|
28
|
+
*
|
|
29
|
+
* type R = NotBooleanType<boolean> // never
|
|
30
|
+
* type R = NotBooleanType<true> // never
|
|
31
|
+
* type R = NotBooleanType<false> // never
|
|
32
|
+
*
|
|
33
|
+
* type R = NotBooleanType<number> // number
|
|
34
|
+
* type R = NotBooleanType<unknown> // unknown
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export type NotBooleanType<T, Then = T, Else = never> = BooleanType<T, Else, Then>
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Is the type `T` `boolean`, including `true` and `false`.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* import type { IsBoolean } from 'type-plus'
|
|
44
|
+
*
|
|
45
|
+
* type R = IsBoolean<boolean> // true
|
|
46
|
+
* type R = IsBoolean<true> // true
|
|
47
|
+
* type R = IsBoolean<false> // true
|
|
48
|
+
*
|
|
49
|
+
* type R = IsBoolean<number> // false
|
|
50
|
+
* type R = IsBoolean<unknown> // false
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export type IsBoolean<T, Then = true, Else = false> = BooleanType<T, Then, Else>
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Is the type `T` not `boolean`, including `true` and `false`.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* import type { IsNotBoolean } from 'type-plus'
|
|
60
|
+
*
|
|
61
|
+
* type R = IsNotBoolean<boolean> // false
|
|
62
|
+
* type R = IsNotBoolean<true> // false
|
|
63
|
+
* type R = IsNotBoolean<false> // false
|
|
64
|
+
*
|
|
65
|
+
* type R = IsNotBoolean<number> // true
|
|
66
|
+
* type R = IsNotBoolean<unknown> // true
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export type IsNotBoolean<T, Then = true, Else = false> = BooleanType<T, Else, Then>
|