News for hackers. Stuff that matters.
Re:Why doesn't TypeScript properly type Object.keys? by iainmerrick on Saturday June 24, 2023 @08:01PM (#36463868)
The value is when you’re parsing the JSON afterwards. It’s good to know you can match it exhaustively -- each value is either a Record<string, Json>, Json[], string, number, Boolean or null, and nothing else.

Edit to add: I think “any” is almost always a big cop-out because you couldn’t be bothered figuring out the correct type, and it often causes problems (loss of type coverage) further down the line. I admit I do use “any” in my own code when I really need to, but a library should work harder to avoid it, and the standard platform typings should work harder still.

There are no comments on this comment yet.