Re:Why doesn't TypeScript properly type Object.keys?
by __ryan__ on Saturday June 24, 2023 @08:22PM
(#36463999)
When does the standard library lie in this case?
Re:Why doesn't TypeScript properly type Object.keys?
by consilient on Saturday June 24, 2023 @10:40PM
(#36464706)
Things are `any` when they should be `unknown` or generic, mostly. Off the top of my head:
- `JSON.parse` and `.json()` on response bodies both return `any`.
- `JSON.stringify`'s `replacer` argument is of type `(key: any, string: any) => any`.
- `PromiseRejectedResult["reason"]` is `any`.
There are certainly many others.
Yes, but one of those bad dependencies is the standard library.