Re:TypeScript types can run DOOM [video]
by epolanski on Thursday February 27, 2025 @02:40AM
(#43192207)
unknown is not equivalent to any as a type constraint: doesn't work.
https://www.totaltypescript.com/any-considered-harmful#type-...
Re:TypeScript types can run DOOM [video]
by matt_kantor on Thursday February 27, 2025 @07:27AM
(#43193748)
The widest possible function type is `(...args: never) => unknown`. This is because parameters are contravariant, and `never` is the bottom type. Using that type works in the author's example[0].
I've got an issue open about TypeScript's provided `ReturnType` type which is somewhat related to this[1].
[1] https://www.typescriptlang.org/docs/handbook/2/everyday-type...
[2] https://www.typescriptlang.org/docs/handbook/release-notes/t...