Releases: DetachHead/ts-helpers
Releases · DetachHead/ts-helpers
12.0.0
What's Changed
Methods
type andbindThis
function by @DetachHead in #175- add
NonNullish
type by @DetachHead in #177 - combine
Any
andmisc
files intomisc
by @DetachHead in #181 - support browsers by deleting stuff that required nodejs by @DetachHead in #183
- add docs for variance modifier types by @DetachHead in #185
Full Changelog: https://github.com/DetachHead/ts-helpers/commits/12.0.0
11.2.0
What's Changed
- bump typescript to 4.8 beta by @DetachHead in #158
- add Variance types (aka arrow/non-arrow function conversion types) by @DetachHead in #159
Full Changelog: 11.1.0...11.2.0
11.1.0
11.0.0
What's Changed
- add
NoAny
by @DetachHead in #126 - update eslint config by @DetachHead in #131
- add
runUntil
function by @DetachHead in #135 - add
DimensionArray
type by @DetachHead in #134 - add
mapAsync
function by @DetachHead in #136 - add
find
andfindAsync
functions by @DetachHead in #138 - support promises in
findAsync
predicate by @DetachHead in #139 throwError
option intoNumber
by @DetachHead in #140- find fixes/refactor by @DetachHead in #145
- bump typescript to 4.7 and workaround for jest crash by @DetachHead in #150
- Exactly fixes by @DetachHead in #151
- Exactly fixes by @DetachHead in #154
- update ts-node to fix jest by @DetachHead in #155
Full Changelog: 10.0.0...11.0.0
10.0.0
What's Changed
- add check for invalid d.ts files as a result of stripped ignore comments by @DetachHead in #110
- String stuff by @DetachHead in #111
- String stuff fixes by @DetachHead in #112
- update ts since they fixed stack depth issues, removed workarounds by @DetachHead in #113
- add uppercase/lowercase functions that use the compiler intrinsic types by @DetachHead in #115
- fix assert logic in exactly function by @DetachHead in #117
- add toNumber function by @DetachHead in #116
- fix hasPropertyPredicate with undefined and null values by @DetachHead in #121
- fix exactly incorrectly comparing undefined types by @DetachHead in #123
- add guid type by @DetachHead in #124
- Remove expect type by @DetachHead in #125
Full Changelog: 9.0.0...10.0.0
9.0.0
What's Changed
- add ipv4/ipv6 types by @DetachHead in #99
- add Integer, PositiveNumber and NegativeNumber types by @DetachHead in #102
- add makeStartsWith and makeEndsWith by @DetachHead in #103
- add epicsauce map function by @DetachHead in #104
- Ts 4.5 by @DetachHead in #100
Full Changelog: 8.2.0...9.0.0
8.2.0
- the
exactly
type testing function now correctly works on intersections - see microsoft/TypeScript#27024 (comment) - add
OnlyInfer
type for generics - add
castArray
function andCastArray
type - some other fixes and stuff
8.1.2
fixed issue where it was always installing dev dependencies
8.1.1
Type Testing
With the exactly
function you can test if types or values are an exact match to a type
const a: 1 | 2 = 1
//values (also does a runtime assertion on the values)
exactly(1 as number, a) // error as `1 | 2` is not an exact match of `number`
exactly(1 as number, a as number) // no error
exactly(1 as 1 | 2, a) // no error
// mixed
exactly<number>()(a) // error as `1 | 2` is not an exact match of `number`
exactly<number>()(a as number) // no error
exactly<1 | 2>()(a) // no error
// types
type Foo = 1 | 2
exactly<1, Foo>() // error as `1 | 2` is not an exact match of `1`
exactly<1 | 2, Foo>() // no error
The Equals
type allows you to check if two types are equal at the type level
Equals<number, 1 | 2> // false
Equals<any, 10> // false
Equals<unknown, never> // false
thanks to @KotlinIsland for helping out with this