type-plus 4.9.1 → 4.10.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/cjs/ComposableTypes.d.ts +1 -0
- package/cjs/ComposableTypes.d.ts.map +1 -0
- package/cjs/JSONTypes.d.ts +1 -0
- package/cjs/JSONTypes.d.ts.map +1 -0
- package/cjs/JSONTypes.js.map +1 -1
- package/cjs/PrimitiveTypes.d.ts +1 -0
- package/cjs/PrimitiveTypes.d.ts.map +1 -0
- package/cjs/UnionKeys.d.ts +1 -0
- package/cjs/UnionKeys.d.ts.map +1 -0
- package/cjs/array/CommonPropKeys.d.ts +2 -1
- package/cjs/array/CommonPropKeys.d.ts.map +1 -0
- package/cjs/array/Concat.d.ts +1 -0
- package/cjs/array/Concat.d.ts.map +1 -0
- package/cjs/array/CreateTuple.d.ts +2 -1
- package/cjs/array/CreateTuple.d.ts.map +1 -0
- package/cjs/array/Filter.d.ts +1 -0
- package/cjs/array/Filter.d.ts.map +1 -0
- package/cjs/array/FindFirst.d.ts +1 -0
- package/cjs/array/FindFirst.d.ts.map +1 -0
- package/cjs/array/FindLast.d.ts +1 -0
- package/cjs/array/FindLast.d.ts.map +1 -0
- package/cjs/array/Head.d.ts +1 -0
- package/cjs/array/Head.d.ts.map +1 -0
- package/cjs/array/IntersectOfProps.d.ts +3 -2
- package/cjs/array/IntersectOfProps.d.ts.map +1 -0
- package/cjs/array/IsArray.d.ts +1 -0
- package/cjs/array/IsArray.d.ts.map +1 -0
- package/cjs/array/Last.d.ts +1 -0
- package/cjs/array/Last.d.ts.map +1 -0
- package/cjs/array/PadLeft.d.ts +4 -3
- package/cjs/array/PadLeft.d.ts.map +1 -0
- package/cjs/array/Reverse.d.ts +1 -0
- package/cjs/array/Reverse.d.ts.map +1 -0
- package/cjs/array/Some.d.ts +4 -3
- package/cjs/array/Some.d.ts.map +1 -0
- package/cjs/array/Tail.d.ts +2 -1
- package/cjs/array/Tail.d.ts.map +1 -0
- package/cjs/array/UnionOfProps.d.ts +3 -2
- package/cjs/array/UnionOfProps.d.ts.map +1 -0
- package/cjs/array/UnionOfValues.d.ts +1 -0
- package/cjs/array/UnionOfValues.d.ts.map +1 -0
- package/cjs/array/drop.d.ts +3 -2
- package/cjs/array/drop.d.ts.map +1 -0
- package/cjs/array/index.d.ts +20 -19
- package/cjs/array/index.d.ts.map +1 -0
- package/cjs/array/index.js +3 -3
- package/cjs/array/index.js.map +1 -1
- package/cjs/array/literalArray.d.ts +2 -1
- package/cjs/array/literalArray.d.ts.map +1 -0
- package/cjs/array/reduceWhile.d.ts +1 -0
- package/cjs/array/reduceWhile.d.ts.map +1 -0
- package/cjs/assertion/assertType.d.ts +3 -2
- package/cjs/assertion/assertType.d.ts.map +1 -0
- package/cjs/assertion/assertType.js +3 -3
- package/cjs/assertion/assertType.js.map +1 -1
- package/cjs/assertion/index.d.ts +2 -1
- package/cjs/assertion/index.d.ts.map +1 -0
- package/cjs/assertion/index.js +1 -1
- package/cjs/assertion/index.js.map +1 -1
- package/cjs/class/AnyConstructor.d.ts +1 -0
- package/cjs/class/AnyConstructor.d.ts.map +1 -0
- package/cjs/class/index.d.ts +3 -2
- package/cjs/class/index.d.ts.map +1 -0
- package/cjs/class/index.js +1 -1
- package/cjs/class/index.js.map +1 -1
- package/cjs/class/isConstructor.d.ts +2 -1
- package/cjs/class/isConstructor.d.ts.map +1 -0
- package/cjs/function/AnyFunction.d.ts +1 -0
- package/cjs/function/AnyFunction.d.ts.map +1 -0
- package/cjs/function/index.d.ts +2 -1
- package/cjs/function/index.d.ts.map +1 -0
- package/cjs/functional/ChainFn.d.ts +1 -0
- package/cjs/functional/ChainFn.d.ts.map +1 -0
- package/cjs/functional/compose.d.ts +3 -2
- package/cjs/functional/compose.d.ts.map +1 -0
- package/cjs/functional/index.d.ts +3 -2
- package/cjs/functional/index.d.ts.map +1 -0
- package/cjs/functional/index.js +1 -1
- package/cjs/functional/index.js.map +1 -1
- package/cjs/index.d.ts +18 -17
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +14 -14
- package/cjs/index.js.map +1 -1
- package/cjs/math/Abs.d.ts +2 -1
- package/cjs/math/Abs.d.ts.map +1 -0
- package/cjs/math/Add.d.ts +7 -6
- package/cjs/math/Add.d.ts.map +1 -0
- package/cjs/math/Digit.d.ts +5 -4
- package/cjs/math/Digit.d.ts.map +1 -0
- package/cjs/math/GreaterThan.d.ts +7 -6
- package/cjs/math/GreaterThan.d.ts.map +1 -0
- package/cjs/math/IsPositive.d.ts +1 -0
- package/cjs/math/IsPositive.d.ts.map +1 -0
- package/cjs/math/IsWhole.d.ts +1 -0
- package/cjs/math/IsWhole.d.ts.map +1 -0
- package/cjs/math/Max.d.ts +3 -2
- package/cjs/math/Max.d.ts.map +1 -0
- package/cjs/math/Subtract.d.ts +7 -6
- package/cjs/math/Subtract.d.ts.map +1 -0
- package/cjs/math/index.d.ts +9 -8
- package/cjs/math/index.d.ts.map +1 -0
- package/cjs/nodejs/index.d.ts +2 -1
- package/cjs/nodejs/index.d.ts.map +1 -0
- package/cjs/nodejs/index.js +1 -1
- package/cjs/nodejs/index.js.map +1 -1
- package/cjs/nodejs/isNodeError.d.ts +1 -0
- package/cjs/nodejs/isNodeError.d.ts.map +1 -0
- package/cjs/nominal-types/Brand.d.ts +3 -2
- package/cjs/nominal-types/Brand.d.ts.map +1 -0
- package/cjs/nominal-types/Brand.js +2 -2
- package/cjs/nominal-types/Brand.js.map +1 -1
- package/cjs/nominal-types/Flavor.d.ts +3 -2
- package/cjs/nominal-types/Flavor.d.ts.map +1 -0
- package/cjs/nominal-types/Flavor.js +2 -2
- package/cjs/nominal-types/Flavor.js.map +1 -1
- package/cjs/nominal-types/index.d.ts +4 -3
- package/cjs/nominal-types/index.d.ts.map +1 -0
- package/cjs/nominal-types/index.js +3 -3
- package/cjs/nominal-types/index.js.map +1 -1
- package/cjs/nominal-types/nominalMatch.d.ts +3 -2
- package/cjs/nominal-types/nominalMatch.d.ts.map +1 -0
- package/cjs/nominal-types/nominalMatch.js +2 -2
- package/cjs/nominal-types/nominalMatch.js.map +1 -1
- package/cjs/nominal-types/types.d.ts +1 -0
- package/cjs/nominal-types/types.d.ts.map +1 -0
- package/cjs/object/ANotB.d.ts +5 -4
- package/cjs/object/ANotB.d.ts.map +1 -0
- package/cjs/object/AnyRecord.d.ts +1 -0
- package/cjs/object/AnyRecord.d.ts.map +1 -0
- package/cjs/object/ExcludePropType.d.ts +1 -0
- package/cjs/object/ExcludePropType.d.ts.map +1 -0
- package/cjs/object/IsDisjoint.d.ts +4 -3
- package/cjs/object/IsDisjoint.d.ts.map +1 -0
- package/cjs/object/IsRecord.d.ts +1 -0
- package/cjs/object/IsRecord.d.ts.map +1 -0
- package/cjs/object/KeyTypes.d.ts +1 -0
- package/cjs/object/KeyTypes.d.ts.map +1 -0
- package/cjs/object/KeyofOptional.d.ts +1 -0
- package/cjs/object/KeyofOptional.d.ts.map +1 -0
- package/cjs/object/KeysWithDiffType.d.ts +4 -3
- package/cjs/object/KeysWithDiffType.d.ts.map +1 -0
- package/cjs/object/KnownKeys.d.ts +2 -1
- package/cjs/object/KnownKeys.d.ts.map +1 -0
- package/cjs/object/OptionalKeys.d.ts +2 -1
- package/cjs/object/OptionalKeys.d.ts.map +1 -0
- package/cjs/object/Partial.d.ts +4 -3
- package/cjs/object/Partial.d.ts.map +1 -0
- package/cjs/object/RecursiveIntersect.d.ts +2 -1
- package/cjs/object/RecursiveIntersect.d.ts.map +1 -0
- package/cjs/object/RecursivePartial.d.ts +2 -1
- package/cjs/object/RecursivePartial.d.ts.map +1 -0
- package/cjs/object/RecursiveRequired.d.ts +2 -1
- package/cjs/object/RecursiveRequired.d.ts.map +1 -0
- package/cjs/object/Required.d.ts +1 -0
- package/cjs/object/Required.d.ts.map +1 -0
- package/cjs/object/RequiredKeys.d.ts +3 -2
- package/cjs/object/RequiredKeys.d.ts.map +1 -0
- package/cjs/object/SpreadRecord.d.ts +2 -1
- package/cjs/object/SpreadRecord.d.ts.map +1 -0
- package/cjs/object/ValueOf.d.ts +1 -0
- package/cjs/object/ValueOf.d.ts.map +1 -0
- package/cjs/object/everyKey.d.ts +2 -1
- package/cjs/object/everyKey.d.ts.map +1 -0
- package/cjs/object/facade.d.ts +2 -1
- package/cjs/object/facade.d.ts.map +1 -0
- package/cjs/object/filterKey.d.ts +2 -1
- package/cjs/object/filterKey.d.ts.map +1 -0
- package/cjs/object/findKey.d.ts +2 -1
- package/cjs/object/findKey.d.ts.map +1 -0
- package/cjs/object/forEachKey.d.ts +2 -1
- package/cjs/object/forEachKey.d.ts.map +1 -0
- package/cjs/object/getField.d.ts +2 -1
- package/cjs/object/getField.d.ts.map +1 -0
- package/cjs/object/hasKey.d.ts +2 -1
- package/cjs/object/hasKey.d.ts.map +1 -0
- package/cjs/object/hasProperty.d.ts +2 -1
- package/cjs/object/hasProperty.d.ts.map +1 -0
- package/cjs/object/index.d.ts +37 -36
- package/cjs/object/index.d.ts.map +1 -0
- package/cjs/object/index.js +18 -18
- package/cjs/object/index.js.map +1 -1
- package/cjs/object/mapKey.d.ts +2 -1
- package/cjs/object/mapKey.d.ts.map +1 -0
- package/cjs/object/mapProperties.d.ts +3 -2
- package/cjs/object/mapProperties.d.ts.map +1 -0
- package/cjs/object/mapProperties.js +2 -2
- package/cjs/object/mapProperties.js.map +1 -1
- package/cjs/object/omit.d.ts +4 -3
- package/cjs/object/omit.d.ts.map +1 -0
- package/cjs/object/omit.js +2 -2
- package/cjs/object/omit.js.map +1 -1
- package/cjs/object/pick.d.ts +3 -2
- package/cjs/object/pick.d.ts.map +1 -0
- package/cjs/object/pick.js +2 -2
- package/cjs/object/pick.js.map +1 -1
- package/cjs/object/record.d.ts +3 -2
- package/cjs/object/record.d.ts.map +1 -0
- package/cjs/object/reduceKey.d.ts +2 -1
- package/cjs/object/reduceKey.d.ts.map +1 -0
- package/cjs/object/replaceProperty.d.ts +2 -1
- package/cjs/object/replaceProperty.d.ts.map +1 -0
- package/cjs/object/someKey.d.ts +2 -1
- package/cjs/object/someKey.d.ts.map +1 -0
- package/cjs/object/split.d.ts +3 -2
- package/cjs/object/split.d.ts.map +1 -0
- package/cjs/object/split.js +3 -3
- package/cjs/object/split.js.map +1 -1
- package/cjs/object/typeOverrideIncompatible.d.ts +2 -1
- package/cjs/object/typeOverrideIncompatible.d.ts.map +1 -0
- package/cjs/predicates/CanAssign.d.ts +3 -2
- package/cjs/predicates/CanAssign.d.ts.map +1 -0
- package/cjs/predicates/Equal.d.ts +1 -0
- package/cjs/predicates/Equal.d.ts.map +1 -0
- package/cjs/predicates/Extends.d.ts +1 -0
- package/cjs/predicates/Extends.d.ts.map +1 -0
- package/cjs/predicates/If.d.ts +1 -0
- package/cjs/predicates/If.d.ts.map +1 -0
- package/cjs/predicates/IsEmptyObject.d.ts +1 -0
- package/cjs/predicates/IsEmptyObject.d.ts.map +1 -0
- package/cjs/predicates/index.d.ts +9 -8
- package/cjs/predicates/index.d.ts.map +1 -0
- package/cjs/predicates/index.js +2 -2
- package/cjs/predicates/index.js.map +1 -1
- package/cjs/predicates/isType.d.ts +3 -2
- package/cjs/predicates/isType.d.ts.map +1 -0
- package/cjs/predicates/isType.js +2 -2
- package/cjs/predicates/isType.js.map +1 -1
- package/cjs/predicates/logical.d.ts +1 -0
- package/cjs/predicates/logical.d.ts.map +1 -0
- package/cjs/promise/PromiseValue.d.ts +1 -0
- package/cjs/promise/PromiseValue.d.ts.map +1 -0
- package/cjs/promise/PromiseValueMerge.d.ts +2 -1
- package/cjs/promise/PromiseValueMerge.d.ts.map +1 -0
- package/cjs/promise/index.d.ts +5 -4
- package/cjs/promise/index.d.ts.map +1 -0
- package/cjs/promise/index.js +2 -2
- package/cjs/promise/index.js.map +1 -1
- package/cjs/promise/isPromise.d.ts +1 -0
- package/cjs/promise/isPromise.d.ts.map +1 -0
- package/cjs/promise/mapSeries.d.ts +1 -0
- package/cjs/promise/mapSeries.d.ts.map +1 -0
- package/cjs/testing/index.d.ts +2 -1
- package/cjs/testing/index.d.ts.map +1 -0
- package/cjs/testing/index.js +1 -1
- package/cjs/testing/index.js.map +1 -1
- package/cjs/testing/stub.d.ts +3 -2
- package/cjs/testing/stub.d.ts.map +1 -0
- package/cjs/utils/NonNull.d.ts +1 -0
- package/cjs/utils/NonNull.d.ts.map +1 -0
- package/cjs/utils/NonUndefined.d.ts +1 -0
- package/cjs/utils/NonUndefined.d.ts.map +1 -0
- package/cjs/utils/Widen.d.ts +1 -0
- package/cjs/utils/Widen.d.ts.map +1 -0
- package/cjs/utils/as.d.ts +1 -0
- package/cjs/utils/as.d.ts.map +1 -0
- package/cjs/utils/index.d.ts +5 -4
- package/cjs/utils/index.d.ts.map +1 -0
- package/cjs/utils/index.js +1 -1
- package/cjs/utils/index.js.map +1 -1
- package/esm/ComposableTypes.d.ts +3 -0
- package/esm/ComposableTypes.d.ts.map +1 -0
- package/esm/JSONTypes.d.ts +12 -0
- package/esm/JSONTypes.d.ts.map +1 -0
- package/esm/JSONTypes.js.map +1 -1
- package/esm/PrimitiveTypes.d.ts +2 -0
- package/esm/PrimitiveTypes.d.ts.map +1 -0
- package/esm/UnionKeys.d.ts +2 -0
- package/esm/UnionKeys.d.ts.map +1 -0
- package/esm/array/CommonPropKeys.d.ts +4 -0
- package/esm/array/CommonPropKeys.d.ts.map +1 -0
- package/esm/array/Concat.d.ts +2 -0
- package/esm/array/Concat.d.ts.map +1 -0
- package/esm/array/CreateTuple.d.ts +3 -0
- package/esm/array/CreateTuple.d.ts.map +1 -0
- package/esm/array/Filter.d.ts +3 -0
- package/esm/array/Filter.d.ts.map +1 -0
- package/esm/array/FindFirst.d.ts +3 -0
- package/esm/array/FindFirst.d.ts.map +1 -0
- package/esm/array/FindLast.d.ts +2 -0
- package/esm/array/FindLast.d.ts.map +1 -0
- package/esm/array/Head.d.ts +2 -0
- package/esm/array/Head.d.ts.map +1 -0
- package/esm/array/IntersectOfProps.d.ts +5 -0
- package/esm/array/IntersectOfProps.d.ts.map +1 -0
- package/esm/array/IsArray.d.ts +2 -0
- package/esm/array/IsArray.d.ts.map +1 -0
- package/esm/array/Last.d.ts +2 -0
- package/esm/array/Last.d.ts.map +1 -0
- package/esm/array/PadLeft.d.ts +5 -0
- package/esm/array/PadLeft.d.ts.map +1 -0
- package/esm/array/Reverse.d.ts +2 -0
- package/esm/array/Reverse.d.ts.map +1 -0
- package/esm/array/Some.d.ts +8 -0
- package/esm/array/Some.d.ts.map +1 -0
- package/esm/array/Tail.d.ts +3 -0
- package/esm/array/Tail.d.ts.map +1 -0
- package/esm/array/UnionOfProps.d.ts +5 -0
- package/esm/array/UnionOfProps.d.ts.map +1 -0
- package/esm/array/UnionOfValues.d.ts +3 -0
- package/esm/array/UnionOfValues.d.ts.map +1 -0
- package/esm/array/drop.d.ts +13 -0
- package/esm/array/drop.d.ts.map +1 -0
- package/esm/array/index.d.ts +20 -0
- package/esm/array/index.d.ts.map +1 -0
- package/esm/array/index.js +3 -3
- package/esm/array/index.js.map +1 -1
- package/esm/array/literalArray.d.ts +3 -0
- package/esm/array/literalArray.d.ts.map +1 -0
- package/esm/array/reduceWhile.d.ts +2 -0
- package/esm/array/reduceWhile.d.ts.map +1 -0
- package/esm/assertion/assertType.d.ts +29 -0
- package/esm/assertion/assertType.d.ts.map +1 -0
- package/esm/assertion/assertType.js +1 -1
- package/esm/assertion/assertType.js.map +1 -1
- package/esm/assertion/index.d.ts +2 -0
- package/esm/assertion/index.d.ts.map +1 -0
- package/esm/assertion/index.js +1 -1
- package/esm/assertion/index.js.map +1 -1
- package/esm/class/AnyConstructor.d.ts +2 -0
- package/esm/class/AnyConstructor.d.ts.map +1 -0
- package/esm/class/index.d.ts +3 -0
- package/esm/class/index.d.ts.map +1 -0
- package/esm/class/index.js +1 -1
- package/esm/class/index.js.map +1 -1
- package/esm/class/isConstructor.d.ts +3 -0
- package/esm/class/isConstructor.d.ts.map +1 -0
- package/esm/function/AnyFunction.d.ts +2 -0
- package/esm/function/AnyFunction.d.ts.map +1 -0
- package/esm/function/index.d.ts +2 -0
- package/esm/function/index.d.ts.map +1 -0
- package/esm/functional/ChainFn.d.ts +3 -0
- package/esm/functional/ChainFn.d.ts.map +1 -0
- package/esm/functional/compose.d.ts +4 -0
- package/esm/functional/compose.d.ts.map +1 -0
- package/esm/functional/index.d.ts +3 -0
- package/esm/functional/index.d.ts.map +1 -0
- package/esm/functional/index.js +1 -1
- package/esm/functional/index.js.map +1 -1
- package/esm/index.d.ts +19 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +14 -14
- package/esm/index.js.map +1 -1
- package/esm/math/Abs.d.ts +3 -0
- package/esm/math/Abs.d.ts.map +1 -0
- package/esm/math/Add.d.ts +16 -0
- package/esm/math/Add.d.ts.map +1 -0
- package/esm/math/Digit.d.ts +97 -0
- package/esm/math/Digit.d.ts.map +1 -0
- package/esm/math/GreaterThan.d.ts +12 -0
- package/esm/math/GreaterThan.d.ts.map +1 -0
- package/esm/math/IsPositive.d.ts +2 -0
- package/esm/math/IsPositive.d.ts.map +1 -0
- package/esm/math/IsWhole.d.ts +2 -0
- package/esm/math/IsWhole.d.ts.map +1 -0
- package/esm/math/Max.d.ts +4 -0
- package/esm/math/Max.d.ts.map +1 -0
- package/esm/math/Subtract.d.ts +13 -0
- package/esm/math/Subtract.d.ts.map +1 -0
- package/esm/math/index.d.ts +9 -0
- package/esm/math/index.d.ts.map +1 -0
- package/esm/nodejs/index.d.ts +2 -0
- package/esm/nodejs/index.d.ts.map +1 -0
- package/esm/nodejs/index.js +1 -1
- package/esm/nodejs/index.js.map +1 -1
- package/esm/nodejs/isNodeError.d.ts +26 -0
- package/esm/nodejs/isNodeError.d.ts.map +1 -0
- package/esm/nominal-types/Brand.d.ts +11 -0
- package/esm/nominal-types/Brand.d.ts.map +1 -0
- package/esm/nominal-types/Brand.js +1 -1
- package/esm/nominal-types/Brand.js.map +1 -1
- package/esm/nominal-types/Flavor.d.ts +8 -0
- package/esm/nominal-types/Flavor.d.ts.map +1 -0
- package/esm/nominal-types/Flavor.js +1 -1
- package/esm/nominal-types/Flavor.js.map +1 -1
- package/esm/nominal-types/index.d.ts +4 -0
- package/esm/nominal-types/index.d.ts.map +1 -0
- package/esm/nominal-types/index.js +3 -3
- package/esm/nominal-types/index.js.map +1 -1
- package/esm/nominal-types/nominalMatch.d.ts +5 -0
- package/esm/nominal-types/nominalMatch.d.ts.map +1 -0
- package/esm/nominal-types/nominalMatch.js +1 -1
- package/esm/nominal-types/nominalMatch.js.map +1 -1
- package/esm/nominal-types/types.d.ts +3 -0
- package/esm/nominal-types/types.d.ts.map +1 -0
- package/esm/object/ANotB.d.ts +14 -0
- package/esm/object/ANotB.d.ts.map +1 -0
- package/esm/object/AnyRecord.d.ts +2 -0
- package/esm/object/AnyRecord.d.ts.map +1 -0
- package/esm/object/ExcludePropType.d.ts +4 -0
- package/esm/object/ExcludePropType.d.ts.map +1 -0
- package/esm/object/IsDisjoint.d.ts +5 -0
- package/esm/object/IsDisjoint.d.ts.map +1 -0
- package/esm/object/IsRecord.d.ts +2 -0
- package/esm/object/IsRecord.d.ts.map +1 -0
- package/esm/object/KeyTypes.d.ts +2 -0
- package/esm/object/KeyTypes.d.ts.map +1 -0
- package/esm/object/KeyofOptional.d.ts +3 -0
- package/esm/object/KeyofOptional.d.ts.map +1 -0
- package/esm/object/KeysWithDiffType.d.ts +7 -0
- package/esm/object/KeysWithDiffType.d.ts.map +1 -0
- package/esm/object/KnownKeys.d.ts +7 -0
- package/esm/object/KnownKeys.d.ts.map +1 -0
- package/esm/object/OptionalKeys.d.ts +8 -0
- package/esm/object/OptionalKeys.d.ts.map +1 -0
- package/esm/object/Partial.d.ts +7 -0
- package/esm/object/Partial.d.ts.map +1 -0
- package/esm/object/RecursiveIntersect.d.ts +5 -0
- package/esm/object/RecursiveIntersect.d.ts.map +1 -0
- package/esm/object/RecursivePartial.d.ts +5 -0
- package/esm/object/RecursivePartial.d.ts.map +1 -0
- package/esm/object/RecursiveRequired.d.ts +5 -0
- package/esm/object/RecursiveRequired.d.ts.map +1 -0
- package/esm/object/Required.d.ts +3 -0
- package/esm/object/Required.d.ts.map +1 -0
- package/esm/object/RequiredKeys.d.ts +7 -0
- package/esm/object/RequiredKeys.d.ts.map +1 -0
- package/esm/object/SpreadRecord.d.ts +3 -0
- package/esm/object/SpreadRecord.d.ts.map +1 -0
- package/esm/object/ValueOf.d.ts +2 -0
- package/esm/object/ValueOf.d.ts.map +1 -0
- package/esm/object/everyKey.d.ts +3 -0
- package/esm/object/everyKey.d.ts.map +1 -0
- package/esm/object/facade.d.ts +14 -0
- package/esm/object/facade.d.ts.map +1 -0
- package/esm/object/filterKey.d.ts +3 -0
- package/esm/object/filterKey.d.ts.map +1 -0
- package/esm/object/findKey.d.ts +3 -0
- package/esm/object/findKey.d.ts.map +1 -0
- package/esm/object/forEachKey.d.ts +3 -0
- package/esm/object/forEachKey.d.ts.map +1 -0
- package/esm/object/getField.d.ts +4 -0
- package/esm/object/getField.d.ts.map +1 -0
- package/esm/object/hasKey.d.ts +4 -0
- package/esm/object/hasKey.d.ts.map +1 -0
- package/esm/object/hasProperty.d.ts +3 -0
- package/esm/object/hasProperty.d.ts.map +1 -0
- package/esm/object/index.d.ts +37 -0
- package/esm/object/index.d.ts.map +1 -0
- package/esm/object/index.js +18 -18
- package/esm/object/index.js.map +1 -1
- package/esm/object/mapKey.d.ts +3 -0
- package/esm/object/mapKey.d.ts.map +1 -0
- package/esm/object/mapProperties.d.ts +6 -0
- package/esm/object/mapProperties.d.ts.map +1 -0
- package/esm/object/mapProperties.js +1 -1
- package/esm/object/mapProperties.js.map +1 -1
- package/esm/object/omit.d.ts +18 -0
- package/esm/object/omit.d.ts.map +1 -0
- package/esm/object/omit.js +1 -1
- package/esm/object/omit.js.map +1 -1
- package/esm/object/pick.d.ts +21 -0
- package/esm/object/pick.d.ts.map +1 -0
- package/esm/object/pick.js +1 -1
- package/esm/object/pick.js.map +1 -1
- package/esm/object/record.d.ts +4 -0
- package/esm/object/record.d.ts.map +1 -0
- package/esm/object/reduceKey.d.ts +4 -0
- package/esm/object/reduceKey.d.ts.map +1 -0
- package/esm/object/replaceProperty.d.ts +6 -0
- package/esm/object/replaceProperty.d.ts.map +1 -0
- package/esm/object/someKey.d.ts +3 -0
- package/esm/object/someKey.d.ts.map +1 -0
- package/esm/object/split.d.ts +82 -0
- package/esm/object/split.d.ts.map +1 -0
- package/esm/object/split.js +1 -1
- package/esm/object/split.js.map +1 -1
- package/esm/object/typeOverrideIncompatible.d.ts +3 -0
- package/esm/object/typeOverrideIncompatible.d.ts.map +1 -0
- package/esm/predicates/CanAssign.d.ts +7 -0
- package/esm/predicates/CanAssign.d.ts.map +1 -0
- package/esm/predicates/Equal.d.ts +5 -0
- package/esm/predicates/Equal.d.ts.map +1 -0
- package/esm/predicates/Extends.d.ts +5 -0
- package/esm/predicates/Extends.d.ts.map +1 -0
- package/esm/predicates/If.d.ts +2 -0
- package/esm/predicates/If.d.ts.map +1 -0
- package/esm/predicates/IsEmptyObject.d.ts +2 -0
- package/esm/predicates/IsEmptyObject.d.ts.map +1 -0
- package/esm/predicates/index.d.ts +12 -0
- package/esm/predicates/index.d.ts.map +1 -0
- package/esm/predicates/index.js +2 -2
- package/esm/predicates/index.js.map +1 -1
- package/esm/predicates/isType.d.ts +11 -0
- package/esm/predicates/isType.d.ts.map +1 -0
- package/esm/predicates/isType.js +1 -1
- package/esm/predicates/isType.js.map +1 -1
- package/esm/predicates/logical.d.ts +5 -0
- package/esm/predicates/logical.d.ts.map +1 -0
- package/esm/promise/PromiseValue.d.ts +2 -0
- package/esm/promise/PromiseValue.d.ts.map +1 -0
- package/esm/promise/PromiseValueMerge.d.ts +3 -0
- package/esm/promise/PromiseValueMerge.d.ts.map +1 -0
- package/esm/promise/index.d.ts +5 -0
- package/esm/promise/index.d.ts.map +1 -0
- package/esm/promise/index.js +2 -2
- package/esm/promise/index.js.map +1 -1
- package/esm/promise/isPromise.d.ts +2 -0
- package/esm/promise/isPromise.d.ts.map +1 -0
- package/esm/promise/mapSeries.d.ts +2 -0
- package/esm/promise/mapSeries.d.ts.map +1 -0
- package/esm/testing/index.d.ts +2 -0
- package/esm/testing/index.d.ts.map +1 -0
- package/esm/testing/index.js +1 -1
- package/esm/testing/index.js.map +1 -1
- package/esm/testing/stub.d.ts +10 -0
- package/esm/testing/stub.d.ts.map +1 -0
- package/esm/utils/NonNull.d.ts +2 -0
- package/esm/utils/NonNull.d.ts.map +1 -0
- package/esm/utils/NonUndefined.d.ts +2 -0
- package/esm/utils/NonUndefined.d.ts.map +1 -0
- package/esm/utils/Widen.d.ts +2 -0
- package/esm/utils/Widen.d.ts.map +1 -0
- package/esm/utils/as.d.ts +7 -0
- package/esm/utils/as.d.ts.map +1 -0
- package/esm/utils/index.d.ts +5 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/package.json +47 -44
- package/ts/JSONTypes.ts +17 -18
- package/ts/array/CommonPropKeys.ts +18 -18
- package/ts/array/CreateTuple.ts +1 -1
- package/ts/array/IntersectOfProps.ts +20 -20
- package/ts/array/PadLeft.ts +3 -3
- package/ts/array/Some.ts +3 -3
- package/ts/array/Tail.ts +1 -1
- package/ts/array/UnionOfProps.ts +18 -18
- package/ts/array/drop.ts +2 -2
- package/ts/array/index.ts +19 -19
- package/ts/array/literalArray.ts +1 -1
- package/ts/assertion/assertType.ts +105 -105
- package/ts/assertion/index.ts +1 -1
- package/ts/binary/_binary.ts +1 -1
- package/ts/binary/index.ts +2 -2
- package/ts/class/index.ts +2 -2
- package/ts/class/isConstructor.ts +1 -1
- package/ts/function/index.ts +1 -1
- package/ts/functional/Maybe.ts +19 -19
- package/ts/functional/compose.ts +2 -2
- package/ts/functional/index.ts +3 -3
- package/ts/index.ts +19 -19
- package/ts/math/Abs.ts +1 -1
- package/ts/math/Add.ts +6 -6
- package/ts/math/Digit.ts +4 -4
- package/ts/math/GreaterThan.ts +6 -6
- package/ts/math/Max.ts +2 -2
- package/ts/math/Subtract.ts +6 -6
- package/ts/math/index.ts +8 -8
- package/ts/nodejs/index.ts +1 -1
- package/ts/nominal-types/Brand.ts +2 -2
- package/ts/nominal-types/Flavor.ts +32 -32
- package/ts/nominal-types/index.ts +3 -3
- package/ts/nominal-types/nominalMatch.ts +3 -3
- package/ts/object/ANotB.ts +21 -21
- package/ts/object/IsDisjoint.ts +12 -12
- package/ts/object/KeysWithDiffType.ts +3 -3
- package/ts/object/KnownKeys.ts +1 -1
- package/ts/object/OptionalKeys.ts +1 -1
- package/ts/object/Partial.ts +3 -3
- package/ts/object/RecursiveIntersect.ts +1 -1
- package/ts/object/RecursivePartial.ts +1 -1
- package/ts/object/RecursiveRequired.ts +1 -1
- package/ts/object/RequiredKeys.ts +2 -2
- package/ts/object/SpreadRecord.ts +6 -6
- package/ts/object/everyKey.ts +1 -1
- package/ts/object/facade.ts +39 -39
- package/ts/object/filterKey.ts +1 -1
- package/ts/object/findKey.ts +1 -1
- package/ts/object/forEachKey.ts +1 -1
- package/ts/object/getField.ts +1 -1
- package/ts/object/hasKey.ts +7 -7
- package/ts/object/hasProperty.ts +1 -1
- package/ts/object/index.ts +36 -36
- package/ts/object/mapKey.ts +1 -1
- package/ts/object/mapProperties.ts +3 -3
- package/ts/object/omit.ts +36 -36
- package/ts/object/pick.ts +35 -35
- package/ts/object/record.ts +3 -3
- package/ts/object/reduceKey.ts +1 -1
- package/ts/object/replaceProperty.ts +1 -1
- package/ts/object/someKey.ts +1 -1
- package/ts/object/split.ts +3 -3
- package/ts/object/typeOverrideIncompatible.ts +10 -10
- package/ts/predicates/CanAssign.ts +2 -2
- package/ts/predicates/index.ts +8 -8
- package/ts/predicates/isType.ts +30 -30
- package/ts/promise/PromiseValueMerge.ts +1 -1
- package/ts/promise/index.ts +4 -4
- package/ts/testing/index.ts +1 -1
- package/ts/testing/stub.ts +2 -2
- package/ts/utils/index.ts +4 -4
- package/ts/ComposableTypes.spec.ts +0 -29
- package/ts/JSONTypes.spec.ts +0 -43
- package/ts/array/CommonPropKeys.spec.ts +0 -20
- package/ts/array/Concat.spec.ts +0 -21
- package/ts/array/CreateTuple.spec.ts +0 -46
- package/ts/array/DropFirst.spec.ts +0 -21
- package/ts/array/DropLast.spec.ts +0 -21
- package/ts/array/DropMatch.spec.ts +0 -234
- package/ts/array/Filter.spec.ts +0 -107
- package/ts/array/FindFirst.spec.ts +0 -27
- package/ts/array/FindLast.spec.ts +0 -27
- package/ts/array/Head.spec.ts +0 -21
- package/ts/array/IntersectOfProps.spec.ts +0 -14
- package/ts/array/Last.spec.ts +0 -32
- package/ts/array/PadLeft.spec.ts +0 -26
- package/ts/array/Reverse.spec.ts +0 -17
- package/ts/array/Some.spec.ts +0 -79
- package/ts/array/Tail.spec.ts +0 -32
- package/ts/array/UnionOfProps.spec.ts +0 -14
- package/ts/array/UnionOfValues.spec.ts +0 -11
- package/ts/array/literalArray.spec.ts +0 -7
- package/ts/array/reduceWhile.spec.ts +0 -27
- package/ts/assertion/assertType.spec.ts +0 -507
- package/ts/binary/index.spec.ts +0 -28
- package/ts/class/AnyConstructor.spec.ts +0 -13
- package/ts/class/isConstructor.spec.ts +0 -35
- package/ts/function/AnyFunction.spec.ts +0 -21
- package/ts/functional/ChainFn.spec.ts +0 -7
- package/ts/functional/Maybe.spec.ts +0 -42
- package/ts/functional/compose.spec.ts +0 -32
- package/ts/index.spec.ts +0 -7
- package/ts/math/Abs.spec.ts +0 -14
- package/ts/math/Add.spec.ts +0 -82
- package/ts/math/Digit.spec.ts +0 -184
- package/ts/math/GreaterThan.spec.ts +0 -75
- package/ts/math/IsPositive.spec.ts +0 -15
- package/ts/math/IsWhole.spec.ts +0 -19
- package/ts/math/Max.spec.ts +0 -59
- package/ts/math/Subtract.spec.ts +0 -40
- package/ts/nodejs/isNodeError.spec.ts +0 -11
- package/ts/nominal-types/Brand.spec.ts +0 -43
- package/ts/nominal-types/Flavor.spec.ts +0 -51
- package/ts/nominal-types/nominalMatch.spec.ts +0 -54
- package/ts/object/ANotB.spec.ts +0 -78
- package/ts/object/ExcludePropType.spec.ts +0 -13
- package/ts/object/IsDisjoint.spec.ts +0 -25
- package/ts/object/IsRecord.spec.ts +0 -22
- package/ts/object/KeyTypes.spec.ts +0 -9
- package/ts/object/KeyofOptional.spec.ts +0 -8
- package/ts/object/KeysWithDiffType.spec.ts +0 -21
- package/ts/object/KnownKeys.spec.ts +0 -39
- package/ts/object/OptionalKeys.spec.ts +0 -23
- package/ts/object/Partial.spec.ts +0 -49
- package/ts/object/RecursiveIntersect.spec.ts +0 -39
- package/ts/object/RecursiveRequired.spec.ts +0 -57
- package/ts/object/Required.spec.ts +0 -29
- package/ts/object/RequiredKeys.spec.ts +0 -24
- package/ts/object/SpreadRecord.spec.ts +0 -14
- package/ts/object/ValueOf.spec.ts +0 -36
- package/ts/object/everyKey.spec.ts +0 -11
- package/ts/object/facade.spec.ts +0 -22
- package/ts/object/filterKey.spec.ts +0 -8
- package/ts/object/findKey.spec.ts +0 -8
- package/ts/object/forEachKey.spec.ts +0 -9
- package/ts/object/getField.spec.ts +0 -21
- package/ts/object/hasKey.spec.ts +0 -29
- package/ts/object/hasProperty.spec.ts +0 -15
- package/ts/object/mapKey.spec.ts +0 -8
- package/ts/object/mapProperties.spec.ts +0 -27
- package/ts/object/omit.spec.ts +0 -104
- package/ts/object/pick.spec.ts +0 -66
- package/ts/object/record.spec.ts +0 -54
- package/ts/object/reduceKey.spec.ts +0 -18
- package/ts/object/replaceProperty.spec.ts +0 -16
- package/ts/object/run.ts +0 -0
- package/ts/object/someKey.spec.ts +0 -6
- package/ts/object/split.spec.ts +0 -119
- package/ts/object/typeOverrideIncompatible.spec.ts +0 -24
- package/ts/predicates/CanAssign.spec.ts +0 -57
- package/ts/predicates/Equal.spec.ts +0 -71
- package/ts/predicates/If.spec.ts +0 -14
- package/ts/predicates/IsEmptyObject.spec.ts +0 -15
- package/ts/predicates/index.spec.ts +0 -73
- package/ts/predicates/isType.spec.ts +0 -106
- package/ts/predicates/logical.spec.ts +0 -59
- package/ts/promise/PromiseValue.spec.ts +0 -6
- package/ts/promise/PromiseValueMerge.spec.ts +0 -7
- package/ts/promise/isPromise.spec.ts +0 -26
- package/ts/promise/mapSeries.spec.ts +0 -12
- package/ts/testing/stub.spec.ts +0 -58
- package/ts/type-checker/.eslintrc.json +0 -7
- package/ts/type-checker/AnyType.ts +0 -13
- package/ts/type-checker/Boolean.ts +0 -34
- package/ts/type-checker/Tuple.spec.ts +0 -15
- package/ts/type-checker/Tuple.ts +0 -14
- package/ts/type-checker/buildTypes.spec.ts +0 -28
- package/ts/type-checker/index.ts +0 -0
- package/ts/type-checker/typeChecker.spec.ts +0 -14
- package/ts/type-checker/typeChecker.ts +0 -52
- package/ts/type-checker/types.ts +0 -19
- package/ts/types/.eslintrc.json +0 -7
- package/ts/types/AllType.ts +0 -31
- package/ts/types/Any.ts +0 -7
- package/ts/types/Array.ts +0 -43
- package/ts/types/BigInt.ts +0 -36
- package/ts/types/Boolean.ts +0 -36
- package/ts/types/Generate.ts +0 -48
- package/ts/types/Null.ts +0 -14
- package/ts/types/Number.ts +0 -56
- package/ts/types/Object.ts +0 -53
- package/ts/types/Record.ts +0 -25
- package/ts/types/String.ts +0 -56
- package/ts/types/Symbol.ts +0 -19
- package/ts/types/Tuple.ts +0 -50
- package/ts/types/Undefined.ts +0 -8
- package/ts/types/Union.ts +0 -46
- package/ts/types/Unknown.ts +0 -9
- package/ts/types/analyze.spec.ts +0 -979
- package/ts/types/analyze.ts +0 -170
- package/ts/types/check.spec.ts +0 -12
- package/ts/types/check.ts +0 -26
- package/ts/types/conform.spec.ts +0 -7
- package/ts/types/conform.ts +0 -27
- package/ts/types/getPlainAnalysisReport.spec.ts +0 -365
- package/ts/types/getPlainAnalysisReport.ts +0 -115
- package/ts/types/index.ts +0 -28
- package/ts/types/optional.ts +0 -30
- package/ts/types/required.ts +0 -30
- package/ts/types/satisfy.accept.ts +0 -39
- package/ts/types/satisfy.spec.ts +0 -600
- package/ts/types/satisfy.ts +0 -27
- package/ts/types/types.ts +0 -10
- package/ts/utils/as.spec.ts +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "type-plus",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Provides additional types for TypeScript.",
|
|
5
5
|
"homepage": "https://github.com/unional/type-plus",
|
|
6
6
|
"bugs": {
|
|
@@ -16,76 +16,79 @@
|
|
|
16
16
|
"email": "homawong@gmail.com"
|
|
17
17
|
},
|
|
18
18
|
"sideEffects": false,
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
"import": "./esm/index.js",
|
|
22
|
+
"require": "./cjs/index.js"
|
|
23
|
+
},
|
|
24
|
+
"main": "./cjs/index.js",
|
|
25
|
+
"typings": "./cjs/index.d.ts",
|
|
23
26
|
"files": [
|
|
24
27
|
"cjs",
|
|
25
28
|
"esm",
|
|
26
|
-
"ts"
|
|
29
|
+
"ts",
|
|
30
|
+
"!ts/**/*.spec.ts",
|
|
31
|
+
"!ts/types",
|
|
32
|
+
"!ts/type-checker"
|
|
27
33
|
],
|
|
28
34
|
"scripts": {
|
|
29
35
|
"build": "run-p build:cjs build:esm",
|
|
30
36
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
31
37
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
32
38
|
"build:doc": "typedoc",
|
|
33
|
-
"clean": "rimraf cjs esm coverage lib libm",
|
|
39
|
+
"clean": "rimraf cjs esm coverage lib libm || true",
|
|
34
40
|
"coverage": "jest --coverage",
|
|
35
|
-
"depcheck": "
|
|
36
|
-
"dependency-check": "run-p dependency-check:unused dependency-check:missing",
|
|
37
|
-
"dependency-check:missing": "dependency-check . --missing --no-dev",
|
|
38
|
-
"dependency-check:unused": "dependency-check . --unused --no-dev -i typescript",
|
|
41
|
+
"depcheck": "depcheck",
|
|
39
42
|
"lint": "eslint --ext=ts,js .",
|
|
40
43
|
"nuke": "yarn clean && rimraf node_modules",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
44
|
+
"_postinstall": "husky install",
|
|
45
|
+
"prepack": "pinst --disable",
|
|
46
|
+
"postpack": "pinst --enable",
|
|
47
|
+
"size": "size-limit",
|
|
43
48
|
"test": "jest",
|
|
44
49
|
"test:types": "tsc",
|
|
45
|
-
"verify": "run-p
|
|
46
|
-
"
|
|
47
|
-
"watch": "jest --watch",
|
|
48
|
-
"prepare": "husky install"
|
|
50
|
+
"verify": "npm-run-all clean -p build depcheck lint coverage -p size",
|
|
51
|
+
"watch": "yarn test --watch"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"tersify": "^3.
|
|
52
|
-
"unpartial": "^0.
|
|
54
|
+
"tersify": "^3.10.0",
|
|
55
|
+
"unpartial": "^0.7.4"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.
|
|
56
|
-
"@babel/plugin-
|
|
57
|
-
"@babel/
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@babel/preset-typescript": "^7.16.7",
|
|
61
|
-
"@commitlint/cli": "^16.2.3",
|
|
62
|
-
"@commitlint/config-conventional": "^16.2.1",
|
|
58
|
+
"@babel/core": "^7.18.2",
|
|
59
|
+
"@babel/plugin-transform-modules-commonjs": "^7.18.2",
|
|
60
|
+
"@babel/preset-env": "^7.18.2",
|
|
61
|
+
"@commitlint/cli": "^17.0.2",
|
|
62
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
63
63
|
"@semantic-release/changelog": "^6.0.1",
|
|
64
|
+
"@semantic-release/git": "^10.0.1",
|
|
65
|
+
"@semantic-release/github": "^8.0.4",
|
|
66
|
+
"@semantic-release/npm": "^9.0.1",
|
|
64
67
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
65
|
-
"@types/jest": "^
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
67
|
-
"@
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"eslint": "^
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"jest": "^28.0.0",
|
|
75
|
-
"jest-progress-tracker": "^3.0.3",
|
|
76
|
-
"jest-validate": "^28.0.0",
|
|
77
|
-
"jest-watch-repeat": "^2.0.0",
|
|
68
|
+
"@types/jest": "^28.1.1",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
70
|
+
"@unional/fixture": "^2.0.0",
|
|
71
|
+
"assertron": "^9.2.3",
|
|
72
|
+
"depcheck": "^1.4.3",
|
|
73
|
+
"eslint": "^8.17.0",
|
|
74
|
+
"eslint-plugin-harmony": "^7.1.0",
|
|
75
|
+
"husky": "^8.0.1",
|
|
76
|
+
"jest": "^28.1.0",
|
|
78
77
|
"jest-watch-suspend": "^1.1.2",
|
|
79
78
|
"jest-watch-toggle-config": "^2.0.1",
|
|
80
|
-
"jest-watch-typeahead": "^1.
|
|
79
|
+
"jest-watch-typeahead": "^1.1.0",
|
|
81
80
|
"npm-run-all": "^4.1.5",
|
|
81
|
+
"pinst": "^3.0.0",
|
|
82
82
|
"rimraf": "^3.0.2",
|
|
83
|
-
"satisfier": "^5.
|
|
83
|
+
"satisfier": "^5.2.0",
|
|
84
|
+
"semantic-release": "^19.0.2",
|
|
84
85
|
"size-limit": "^7.0.8",
|
|
85
|
-
"
|
|
86
|
+
"ts-jest": "^28.0.4",
|
|
87
|
+
"typedoc": "^0.22.17",
|
|
86
88
|
"typedoc-plugin-extras": "^2.2.3",
|
|
87
|
-
"typescript": "
|
|
89
|
+
"typescript": "4.7.3"
|
|
88
90
|
},
|
|
91
|
+
"packageManager": "yarn@3.2.1",
|
|
89
92
|
"size-limit": [
|
|
90
93
|
{
|
|
91
94
|
"limit": "15 kb"
|
package/ts/JSONTypes.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
export type JSONTypes = JSONPrimitive | JSONObject | JSONArray
|
|
2
|
+
|
|
3
|
+
export type JSONPrimitive = boolean | number | string | null
|
|
4
|
+
|
|
5
|
+
export type JSONObject = { [key in string]?: JSONTypes }
|
|
6
|
+
|
|
7
|
+
export type JSONArray = Array<JSONTypes>
|
|
8
|
+
|
|
9
|
+
export const JSONTypes = { get }
|
|
10
|
+
|
|
11
|
+
function get<T extends JSONTypes>(obj: JSONTypes, ...props: Array<string | number>): T | undefined {
|
|
12
|
+
if (props.length === 0) return obj as T
|
|
13
|
+
if (typeof obj !== 'object' || obj === null) return undefined
|
|
14
|
+
const p = props.shift()!
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
return get(obj[p], ...props) as T
|
|
17
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Tail } from './Tail'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gets the common property keys of the elements in `A`.
|
|
5
|
-
*/
|
|
6
|
-
export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0
|
|
7
|
-
? never
|
|
8
|
-
: (A['length'] extends 1
|
|
9
|
-
? keyof A[0]
|
|
10
|
-
: (A['length'] extends 2
|
|
11
|
-
? keyof A[0] & keyof A[1]
|
|
12
|
-
: keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>))
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets the common property keys of the elements in `A`.
|
|
16
|
-
* This will be deprecated in 4.0. Please use CommonPropKeys instead.
|
|
17
|
-
*/
|
|
18
|
-
export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>
|
|
1
|
+
import type { Tail } from './Tail.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gets the common property keys of the elements in `A`.
|
|
5
|
+
*/
|
|
6
|
+
export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0
|
|
7
|
+
? never
|
|
8
|
+
: (A['length'] extends 1
|
|
9
|
+
? keyof A[0]
|
|
10
|
+
: (A['length'] extends 2
|
|
11
|
+
? keyof A[0] & keyof A[1]
|
|
12
|
+
: keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>))
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the common property keys of the elements in `A`.
|
|
16
|
+
* This will be deprecated in 4.0. Please use CommonPropKeys instead.
|
|
17
|
+
*/
|
|
18
|
+
export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>
|
package/ts/array/CreateTuple.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { KeyTypes } from '../object'
|
|
2
|
-
import { Tail } from './Tail'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets the intersect of properties of the elements in `A`
|
|
6
|
-
*/
|
|
7
|
-
export type IntersectOfProps<
|
|
8
|
-
A extends Record<any, unknown>[],
|
|
9
|
-
P extends KeyTypes
|
|
10
|
-
> = A['length'] extends 0
|
|
11
|
-
? never
|
|
12
|
-
: (A['length'] extends 1
|
|
13
|
-
? A[0][P]
|
|
14
|
-
: A[0][P] & IntersectOfProps<Tail<A>, P>)
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the intersect of properties of the elements in `A`
|
|
18
|
-
* This will be deprecated in 4.0. Please use IntersectOfProps instead.
|
|
19
|
-
*/
|
|
20
|
-
export type MapToProp<A extends Record<any, any>[], P extends KeyTypes> = IntersectOfProps<A, P>
|
|
1
|
+
import type { KeyTypes } from '../object/index.js'
|
|
2
|
+
import type { Tail } from './Tail.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets the intersect of properties of the elements in `A`
|
|
6
|
+
*/
|
|
7
|
+
export type IntersectOfProps<
|
|
8
|
+
A extends Record<any, unknown>[],
|
|
9
|
+
P extends KeyTypes
|
|
10
|
+
> = A['length'] extends 0
|
|
11
|
+
? never
|
|
12
|
+
: (A['length'] extends 1
|
|
13
|
+
? A[0][P]
|
|
14
|
+
: A[0][P] & IntersectOfProps<Tail<A>, P>)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gets the intersect of properties of the elements in `A`
|
|
18
|
+
* This will be deprecated in 4.0. Please use IntersectOfProps instead.
|
|
19
|
+
*/
|
|
20
|
+
export type MapToProp<A extends Record<any, any>[], P extends KeyTypes> = IntersectOfProps<A, P>
|
package/ts/array/PadLeft.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Equal, IsAny } from '../predicates'
|
|
2
|
-
import { CreateTuple } from './CreateTuple'
|
|
3
|
-
import { UnionOfValues } from './UnionOfValues'
|
|
1
|
+
import { Equal, IsAny } from '../predicates/index.js'
|
|
2
|
+
import { CreateTuple } from './CreateTuple.js'
|
|
3
|
+
import { UnionOfValues } from './UnionOfValues.js'
|
|
4
4
|
|
|
5
5
|
export type PadLeft<A extends any[], Total extends number, PadWith = any> =
|
|
6
6
|
number extends A['length']
|
package/ts/array/Some.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Equal } from '../predicates'
|
|
2
|
-
import type { Tail } from './Tail'
|
|
3
|
-
import type { UnionOfValues } from './UnionOfValues'
|
|
1
|
+
import type { Equal } from '../predicates/index.js'
|
|
2
|
+
import type { Tail } from './Tail.js'
|
|
3
|
+
import type { UnionOfValues } from './UnionOfValues.js'
|
|
4
4
|
|
|
5
5
|
export type Some<
|
|
6
6
|
A extends any[],
|
package/ts/array/Tail.ts
CHANGED
package/ts/array/UnionOfProps.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { KeyTypes } from '../object'
|
|
2
|
-
import { Tail } from './Tail'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets the union of properties of the elements in `A`
|
|
6
|
-
*/
|
|
7
|
-
export type UnionOfProps<A extends Record<any, any>[], P extends KeyTypes> =
|
|
8
|
-
A['length'] extends 0
|
|
9
|
-
? never
|
|
10
|
-
: (A['length'] extends 1
|
|
11
|
-
? A[0][P]
|
|
12
|
-
: A[0][P] | UnionOfProps<Tail<A>, P>)
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Gets the union of properties in the element of `A`
|
|
16
|
-
* This will be deprecated in 4.0. Please use UnionOfProps instead.
|
|
17
|
-
*/
|
|
18
|
-
export type PropUnion<A extends Record<any, any>[], P extends KeyTypes> = UnionOfProps<A, P>
|
|
1
|
+
import type { KeyTypes } from '../object/index.js'
|
|
2
|
+
import type { Tail } from './Tail.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets the union of properties of the elements in `A`
|
|
6
|
+
*/
|
|
7
|
+
export type UnionOfProps<A extends Record<any, any>[], P extends KeyTypes> =
|
|
8
|
+
A['length'] extends 0
|
|
9
|
+
? never
|
|
10
|
+
: (A['length'] extends 1
|
|
11
|
+
? A[0][P]
|
|
12
|
+
: A[0][P] | UnionOfProps<Tail<A>, P>)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the union of properties in the element of `A`
|
|
16
|
+
* This will be deprecated in 4.0. Please use UnionOfProps instead.
|
|
17
|
+
*/
|
|
18
|
+
export type PropUnion<A extends Record<any, any>[], P extends KeyTypes> = UnionOfProps<A, P>
|
package/ts/array/drop.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Equal } from '../predicates'
|
|
2
|
-
import { NonNull, NonUndefined } from '../utils'
|
|
1
|
+
import type { Equal } from '../predicates/index.js'
|
|
2
|
+
import type { NonNull, NonUndefined } from '../utils/index.js'
|
|
3
3
|
|
|
4
4
|
export type DropFirst<A extends any[]> = number extends A['length']
|
|
5
5
|
? A
|
package/ts/array/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export type { CommonKeys, CommonPropKeys } from './CommonPropKeys'
|
|
2
|
-
export type { Concat } from './Concat'
|
|
3
|
-
export type { CreateTuple } from './CreateTuple'
|
|
4
|
-
export * from './drop'
|
|
5
|
-
export type { Filter, KeepMatch } from './Filter'
|
|
6
|
-
export type { FindFirst, First } from './FindFirst'
|
|
7
|
-
export type { FindLast } from './FindLast'
|
|
8
|
-
export type { Head } from './Head'
|
|
9
|
-
export type { IntersectOfProps, MapToProp } from './IntersectOfProps'
|
|
10
|
-
export type { IsArray } from './IsArray'
|
|
11
|
-
export type { Last } from './Last'
|
|
12
|
-
export * from './literalArray'
|
|
13
|
-
export type { PadLeft } from './PadLeft'
|
|
14
|
-
export * from './reduceWhile'
|
|
15
|
-
export type { Reverse } from './Reverse'
|
|
16
|
-
export type { Some } from './Some'
|
|
17
|
-
export type { Tail } from './Tail'
|
|
18
|
-
export type { PropUnion, UnionOfProps } from './UnionOfProps'
|
|
19
|
-
export type { ArrayValue, UnionOfValues } from './UnionOfValues'
|
|
1
|
+
export type { CommonKeys, CommonPropKeys } from './CommonPropKeys.js'
|
|
2
|
+
export type { Concat } from './Concat.js'
|
|
3
|
+
export type { CreateTuple } from './CreateTuple.js'
|
|
4
|
+
export * from './drop.js'
|
|
5
|
+
export type { Filter, KeepMatch } from './Filter.js'
|
|
6
|
+
export type { FindFirst, First } from './FindFirst.js'
|
|
7
|
+
export type { FindLast } from './FindLast.js'
|
|
8
|
+
export type { Head } from './Head.js'
|
|
9
|
+
export type { IntersectOfProps, MapToProp } from './IntersectOfProps.js'
|
|
10
|
+
export type { IsArray } from './IsArray.js'
|
|
11
|
+
export type { Last } from './Last.js'
|
|
12
|
+
export * from './literalArray.js'
|
|
13
|
+
export type { PadLeft } from './PadLeft.js'
|
|
14
|
+
export * from './reduceWhile.js'
|
|
15
|
+
export type { Reverse } from './Reverse.js'
|
|
16
|
+
export type { Some } from './Some.js'
|
|
17
|
+
export type { Tail } from './Tail.js'
|
|
18
|
+
export type { PropUnion, UnionOfProps } from './UnionOfProps.js'
|
|
19
|
+
export type { ArrayValue, UnionOfValues } from './UnionOfValues.js'
|
|
20
20
|
|
package/ts/array/literalArray.ts
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { tersify } from 'tersify'
|
|
2
|
-
import { AnyConstructor, isConstructor } from '../class'
|
|
3
|
-
import { AnyFunction } from '../function'
|
|
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>(subject: unknown, constructor: T): asserts subject is InstanceType<T>
|
|
12
|
-
export function assertType(subject: unknown, validator?: (s: any) => boolean) {
|
|
13
|
-
if (validator) {
|
|
14
|
-
if ((isConstructor(validator) && !(subject instanceof validator)) || !validator(subject))
|
|
15
|
-
throw new TypeError(`subject fails to satisfy ${tersify(validator)}`)
|
|
16
|
-
}
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
assertType.isUndefined = function (subject: undefined): asserts subject is undefined {
|
|
21
|
-
if (typeof subject !== 'undefined') throw TypeError(`subject is not undefined`)
|
|
22
|
-
}
|
|
23
|
-
assertType.noUndefined = function <S>(subject: Exclude<S, undefined>): void {
|
|
24
|
-
if (typeof subject === 'undefined') throw TypeError(`subject is undefined`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
assertType.isNull = function (subject: null): asserts subject is null {
|
|
28
|
-
if (subject !== null) throw TypeError(`subject is not null`)
|
|
29
|
-
}
|
|
30
|
-
assertType.noNull = function <S>(subject: Exclude<S, null>): void {
|
|
31
|
-
if (subject === null) throw TypeError(`subject is null`)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
assertType.isNumber = function (subject: number): asserts subject is number {
|
|
35
|
-
if (typeof subject !== 'number') throw TypeError(`subject is not number`)
|
|
36
|
-
}
|
|
37
|
-
assertType.noNumber = function <S>(subject: Exclude<S, number>): void {
|
|
38
|
-
if (typeof subject === 'number') throw TypeError(`subject is number`)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
assertType.isBoolean = function (subject: boolean): asserts subject is boolean {
|
|
42
|
-
if (typeof subject !== 'boolean') throw TypeError(`subject is not boolean`)
|
|
43
|
-
}
|
|
44
|
-
assertType.noBoolean = function <S>(subject: Exclude<S, boolean>): void {
|
|
45
|
-
if (typeof subject === 'boolean') throw TypeError(`subject is boolean`)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
assertType.isTrue = function (subject: true): asserts subject is true {
|
|
49
|
-
if (subject !== true) throw TypeError(`subject is not true`)
|
|
50
|
-
}
|
|
51
|
-
assertType.noTrue = function <S>(subject: Exclude<S, true>): void {
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
if (subject === true) throw TypeError(`subject is true`)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
assertType.isFalse = function (subject: false): asserts subject is false {
|
|
57
|
-
if (subject !== false) throw TypeError(`subject is not false`)
|
|
58
|
-
}
|
|
59
|
-
assertType.noFalse = function <S>(subject: Exclude<S, false>): void {
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
if (subject === false) throw TypeError(`subject is false`)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
assertType.isString = function (subject: string): asserts subject is string {
|
|
65
|
-
if (typeof subject !== 'string') throw TypeError(`subject is not string`)
|
|
66
|
-
}
|
|
67
|
-
assertType.noString = function <S>(subject: Exclude<S, string>): void {
|
|
68
|
-
if (typeof subject === 'string') throw TypeError(`subject is string`)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
assertType.isFunction = function (subject: AnyFunction): asserts subject is AnyFunction {
|
|
72
|
-
if (typeof subject !== 'function') throw TypeError(`subject is not function`)
|
|
73
|
-
}
|
|
74
|
-
assertType.noFunction = function <S>(subject: Exclude<S, AnyFunction>): void {
|
|
75
|
-
if (typeof subject === 'function') throw TypeError(`subject is function`)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
assertType.isConstructor = function (subject: AnyConstructor): asserts subject is AnyConstructor {
|
|
79
|
-
if (!isConstructor(subject)) throw TypeError(`subject is not a constructor`)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
assertType.isError = function (subject: Error): asserts subject is Error {
|
|
83
|
-
if (!(subject instanceof Error)) throw TypeError(`subject is not an Error`)
|
|
84
|
-
}
|
|
85
|
-
assertType.noError = function <S>(subject: Exclude<S, Error>): void {
|
|
86
|
-
if (subject instanceof Error) throw TypeError(`subject is an Error`)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
assertType.isNever = function (subject: never): asserts subject is never {
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* creates a custom assertion function with standard TypeError.
|
|
94
|
-
* Currently this requires explicity type annotation,
|
|
95
|
-
* thus making it hard to use:
|
|
96
|
-
* https://github.com/microsoft/TypeScript/issues/41047
|
|
97
|
-
*/
|
|
98
|
-
assertType.custom = function <T>(
|
|
99
|
-
validator: (s: T) => boolean
|
|
100
|
-
): (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
|
-
}
|
|
1
|
+
import { tersify } from 'tersify'
|
|
2
|
+
import { AnyConstructor, isConstructor } from '../class/index.js'
|
|
3
|
+
import type { AnyFunction } from '../function/index.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>(subject: unknown, constructor: T): asserts subject is InstanceType<T>
|
|
12
|
+
export function assertType(subject: unknown, validator?: (s: any) => boolean) {
|
|
13
|
+
if (validator) {
|
|
14
|
+
if ((isConstructor(validator) && !(subject instanceof validator)) || !validator(subject))
|
|
15
|
+
throw new TypeError(`subject fails to satisfy ${tersify(validator)}`)
|
|
16
|
+
}
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
assertType.isUndefined = function (subject: undefined): asserts subject is undefined {
|
|
21
|
+
if (typeof subject !== 'undefined') throw TypeError(`subject is not undefined`)
|
|
22
|
+
}
|
|
23
|
+
assertType.noUndefined = function <S>(subject: Exclude<S, undefined>): void {
|
|
24
|
+
if (typeof subject === 'undefined') throw TypeError(`subject is undefined`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
assertType.isNull = function (subject: null): asserts subject is null {
|
|
28
|
+
if (subject !== null) throw TypeError(`subject is not null`)
|
|
29
|
+
}
|
|
30
|
+
assertType.noNull = function <S>(subject: Exclude<S, null>): void {
|
|
31
|
+
if (subject === null) throw TypeError(`subject is null`)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
assertType.isNumber = function (subject: number): asserts subject is number {
|
|
35
|
+
if (typeof subject !== 'number') throw TypeError(`subject is not number`)
|
|
36
|
+
}
|
|
37
|
+
assertType.noNumber = function <S>(subject: Exclude<S, number>): void {
|
|
38
|
+
if (typeof subject === 'number') throw TypeError(`subject is number`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
assertType.isBoolean = function (subject: boolean): asserts subject is boolean {
|
|
42
|
+
if (typeof subject !== 'boolean') throw TypeError(`subject is not boolean`)
|
|
43
|
+
}
|
|
44
|
+
assertType.noBoolean = function <S>(subject: Exclude<S, boolean>): void {
|
|
45
|
+
if (typeof subject === 'boolean') throw TypeError(`subject is boolean`)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
assertType.isTrue = function (subject: true): asserts subject is true {
|
|
49
|
+
if (subject !== true) throw TypeError(`subject is not true`)
|
|
50
|
+
}
|
|
51
|
+
assertType.noTrue = function <S>(subject: Exclude<S, true>): void {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
if (subject === true) throw TypeError(`subject is true`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
assertType.isFalse = function (subject: false): asserts subject is false {
|
|
57
|
+
if (subject !== false) throw TypeError(`subject is not false`)
|
|
58
|
+
}
|
|
59
|
+
assertType.noFalse = function <S>(subject: Exclude<S, false>): void {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
if (subject === false) throw TypeError(`subject is false`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
assertType.isString = function (subject: string): asserts subject is string {
|
|
65
|
+
if (typeof subject !== 'string') throw TypeError(`subject is not string`)
|
|
66
|
+
}
|
|
67
|
+
assertType.noString = function <S>(subject: Exclude<S, string>): void {
|
|
68
|
+
if (typeof subject === 'string') throw TypeError(`subject is string`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
assertType.isFunction = function (subject: AnyFunction): asserts subject is AnyFunction {
|
|
72
|
+
if (typeof subject !== 'function') throw TypeError(`subject is not function`)
|
|
73
|
+
}
|
|
74
|
+
assertType.noFunction = function <S>(subject: Exclude<S, AnyFunction>): void {
|
|
75
|
+
if (typeof subject === 'function') throw TypeError(`subject is function`)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
assertType.isConstructor = function (subject: AnyConstructor): asserts subject is AnyConstructor {
|
|
79
|
+
if (!isConstructor(subject)) throw TypeError(`subject is not a constructor`)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
assertType.isError = function (subject: Error): asserts subject is Error {
|
|
83
|
+
if (!(subject instanceof Error)) throw TypeError(`subject is not an Error`)
|
|
84
|
+
}
|
|
85
|
+
assertType.noError = function <S>(subject: Exclude<S, Error>): void {
|
|
86
|
+
if (subject instanceof Error) throw TypeError(`subject is an Error`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
assertType.isNever = function (subject: never): asserts subject is never {
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* creates a custom assertion function with standard TypeError.
|
|
94
|
+
* Currently this requires explicity type annotation,
|
|
95
|
+
* thus making it hard to use:
|
|
96
|
+
* https://github.com/microsoft/TypeScript/issues/41047
|
|
97
|
+
*/
|
|
98
|
+
assertType.custom = function <T>(
|
|
99
|
+
validator: (s: T) => boolean
|
|
100
|
+
): (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
|
+
}
|
package/ts/assertion/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './assertType'
|
|
1
|
+
export * from './assertType.js'
|
package/ts/binary/_binary.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Bit, BitAnd, BitNot, BitOr, BitXor } from './Bit'
|
|
1
|
+
export type { Bit, BitAnd, BitNot, BitOr, BitXor } from './Bit.js'
|
package/ts/binary/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as B from './_binary'
|
|
2
|
-
export * as Bit from './_binary'
|
|
1
|
+
export * as B from './_binary.js'
|
|
2
|
+
export * as Bit from './_binary.js'
|
package/ts/class/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AnyConstructor } from './AnyConstructor'
|
|
2
|
-
export * from './isConstructor'
|
|
1
|
+
export type { AnyConstructor } from './AnyConstructor.js'
|
|
2
|
+
export * from './isConstructor.js'
|
package/ts/function/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { AnyFunction } from './AnyFunction'
|
|
1
|
+
export type { AnyFunction } from './AnyFunction.js'
|