Additional types and types adjusted utilities for TypeScript
MIT License
Bot releases are visible (Hide)
Published by unional about 1 month ago
AdjustExactOptionalProps
.Published by unional about 1 month ago
$Exact
namespace.$Exact.$Options
is now $ExactOptions
.$Exact.$Default
is now $ExactDefault
.$Exact.$IsExact
is now $IsExact
.typesVersions
field in package.json
.SubUnion
type.$Exact
branch type. It is not needed anymore.Published by unional 3 months ago
bbe256cb5: Remove exports.default
in package.json
.
That provide the wrong file to systems expecting CJS.
May need to add a different one for browser-spec.
Published by unional 7 months ago
IsPositive<number & { a: 1 }>
should return boolean
Omit
type as the simpler code is working with typescript 5.4Zeros
.numerics
IsInteger<number & { a: 1 }>
should returns boolean
IsNegative<number & { a: 1 }>
should return boolean
Published by unional 7 months ago
Fixed excessive stack depth error around Zeros
type #427 by @ehoogeveen-medweb
Simplify Omit
type as the simpler code is working with typescript 5.4
Published by unional about 1 year ago
case*
to $*
to make them easier to use.afac18a02: Add IsStrictObject<T>
type.
b98ed6d9f: Accept readonly
for array.
Add ArrayPlus.IsReadonly
.
Fix ArrayPlus.Reverse
to support readonly
.
69c540985: Add Merge<A, B>
and ObjectPlus.Merge<A, B>
de549578a: Add customize support for ArrayPlus.Filter
711639289: Add Box<T>
to box primitive types to their boxed types.
3ed4dce5e: Optimize SplitAt
by moving never check of DeleteCount
to the top.
5535a4a6d: fix IsArray<never[]>
d852d76b3: Add docs for ArrayPlus.IsReadonly
.
The following are internal changes thus not considered a breaking change:
MergeOptions
/MergeCases
with TypePlusOptions.Merge
.TypePlusOptions.Predicate
to TypePlusOptions.Selection
.Published by unional over 1 year ago
Delete
and Insert
for SplitAt
.Published by unional over 1 year ago
4f1e6e813: Add UnionType
and IsUnion
1bee3922b: Improve FindFirst
and ArrayPlus.Find
to support union_miss
and never
cases,
and some bug fixes.
b3d0af0d2: Export the improved Required
type.
bc535d4dd: Support customization for Head
and Tail
d2f97ca18: Add options support for:
TupleType
, IsTuple
, NotTupleType
, IsNotTuple
DropFirst
, DropLast
,FindFirst
, ArrayPlus.FindFirst
, TuplePlus.FindFirst
Add MergeOptions
.
Add NotUnknownOr
(all use cases are handled by MergeOptions
at the moment)
94bb1c00c: Improve FindFirst
,
add ArrayPlus.Find
and TuplePlus.Find
4e7e31098: Clean up CommonPropKeys
.
Add ArrayPlus.CommonPropKeys
and TuplePlus.CommonPropKeys
.
Add support of caseNever
.
7a647ca41: Support override never
case for TupleType
, IsTuple
, IsNotTuple
, and NotTupleType
91211c9b5: Rename caseNoMatch
to caseNotMatch
.
Rename caseUnionMiss
to caseUnionNotMatch
.
Change caseUnionNotMatch
default from undefined
to never
,
making it defaults to the type behavior instead of JavaScript behavior.
8a60488be: Move TestType under testType
so that it is exported
Published by unional over 1 year ago
drop()
as it does not sufficiently support the needed types.extends()
, union()
, intersect()
, union_*
, intersect_*
to InspectedType
.Filter
and PadStart
for array and tupleHead
and Last
to support empty_tuple overrideIntersectOfProps
to work with array just for completeness.DropFirst
and DropLast
to support overriding cases../package.json
.CommonPropKeys
Published by unional over 1 year ago
Published by unional over 1 year ago
IsOptionalKey<T, K>
.OptionalProps<T>
.OptionalKeys<T>
and IsOptionalKey<T, K>
OptionalKeys<T>
d214ce6d7: Improve testType.inspect<T>(fn)
to provide more information about T
.
Not consider as breaking change as the function is not expected to be use in any code.
Published by unional over 1 year ago
IsLiteral
type to support boolean
, bigint
, and symbol
.LeftJoin
type behavior.Published by unional over 1 year ago
testType.inspect<T>(fn)
for easy type inspection.Published by unional over 1 year ago
RecursivePartial
to work with function type.| undefined
to make it compliant with exactOptionalPropertyTypes
.Published by unional over 1 year ago
aacb1ff4: Add AnyOrNeverType
for parity.
Update some code's JSDocs.
exports
field{}
for LeftJoin
verbatimModuleSyntax
Published by unional over 1 year ago
@internal
. It is causing those types to be skipped from output (cjs/esm/*.d.ts).Published by unional over 1 year ago
91c954fb: Remove Digit
and DigitArray
.
They are internal types to begin with.
They were exported probably to fix the "type cannot be named" error.
469c8bd2: Fix array PadStart
/PadLeft
that triggers an infinite loop.
Change default PadWith
from any
to unknown
(breaking).
Update Add
, Subtract
, and added Multiply
which now works with number
, bigint
, positive, negative, and floating point.
e11d43c5: Expose FindLast
also as ArrayPlus.FindList
.
Improved its handling of array.
25e5fcb2: add NumericPlus
ee14247c: Add ArrayPlus.SplitAt
a49abe20: Mark the following code as deprecated:
isType.t()
isType.f()
isType.never()
4352d514: Add StringToNumber
, StringToBigint
, and StringToNumeric
e93e366d: Add alternative Partial<T>
type that works with exactOptionalPropertyTypes
.
10af3634: Add ArrayPlus.Reverse<A>
82ffd7d9: Add NumericToString
72aca9d0: Add MathPlus.ToNegative
09495bec: Add ArrayPlus.Entries<A>
.
3e0e199b: Add remaining types to testType.*
.
testType
is changed to a proxy to simplify implementation.
73bbcf0e: Add PadStart
, deprecase PadLeft
65e84c4b: Expose FindFirst
also as ArrayPlus.Find
.
Improved its handling of array.
d2997ded: Deprecate Equal
and NotEqual
. They are renamed to IsEqual
and IsNotEqual
.
Equal
and NotEqual
will be changed to filter
variant (a.k.a. parse
variant) in the future.
180a455e: Add TuplePlus.PadStart
.
7bf5d39e: Add StrictCanAssign<A,B>
and testType.strictCanAssign()
010a7880: Deprecate assertType(subject constructor)
.
Add T/F
to Extendable
and NotExtendable
.
74cc6545: Alias Some
under ArrayPlus.Some
.
4054c64b: GreaterThan
and Max
now support floating point and negative numbers, and bigint
84617522: At
should return V | undefined
for tuple when N
is number
(or any
which includes number
).
aaffd23e: fix Some<Array<number | string>, number>
to return boolean
.
This is because besides Array<number | string>
can be [1, 'a']
,
it can also be:
const v: number | string = 123
const a: Array<number | string> = [v]
So Some<Array<number | string>, number>
should distribute and return boolean
.
4878eb07: At
should return V | undefined
for array.
afc1840c: Add Upper
and Lower
for IndexAt
.
This allow fine-grained control over the IndexAt
behavior,
when the value is out of bounds.
This is used in cases where out-of-bounds values are coarsen to the upper and lower bound of the subject array.
d31ea31f: Improve Abs
to work with bigint
Published by unional over 1 year ago
Published by unional over 1 year ago
38b59e9b: Add stub.builder()
c2b6f375: Add more testType.*
:
testType.undefined()
testType.null()
testType.bigint()
testType.strictBigint()
testType.string()
testType.strictString()
stub.build()
should not accept no init
value.