News for hackers. Stuff that matters.
Re:Show HN: Ezno, a type checker for JavaScript and optimise... by madeofpalk on Friday September 23, 2022 @03:13PM (#32955885)
You can't actually narrow `unknown` down to a structure yet, as you have no way to test whether `property in unknown` or not.

Well, until this is released! https://github.com/microsoft/TypeScript/pull/50666

Re:Show HN: Ezno, a type checker for JavaScript and optimise... by mhermher on Friday September 23, 2022 @04:39PM (#32956790)
yeah. You have to assert an object (`Record<string, unknown>`) type first within your asserter (or array or whatever). We ended up having whole stacks of re-usable assertion functions to be used at these boundaries (re-usable on server side too if you're using node!)