ts-helpers
ts-helpers copied to clipboard
various typescript helper functions and utility types
not like `UnsafeVariance` because as the name suggests, it's unsafe. all it does is make the type bivariant without filtering out methods that are unsafe to call
like #162 but for the whole class
there are some wacky types that take several seconds to compile
related: #127 added a bunch of tests in 2a2e8383a7d9f963d373388ea4428f8e912b9af0
https://github.com/DetachHead/ts-helpers/blob/32d918e0da2399450b7769e4d178a1a2adfb7d81/src/utilityTypes/Function.ts#L50 ```typescript import { AnyFunction } from 'tsdef' /** * converts a non-arrow function type to an arrow function type. arrow functions are checked more strictly than * non-arrow functions...
fix these. TS2590: Expression produces a union type that is too complex to represent. https://github.com/DetachHead/ts-helpers/blob/44934820f0b1ebfa7eb0240b57777d75e5810f6b/src/utilityTypes/Date.ts#L171 ```typescript import { Enumerate, LeadingZeros, Ordinal, RangeType } from './Number' import { EnumerateAsString, PadStart, RangeAsString,...
```ts exactly number, (a?: number) => number>() ```
https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#optional-variance-annotations-for-type-parameters