3 ms·
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! htt
by madeofpalk 4y ago
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 https://github.com/microsoft/TypeScript/pull/50666
- mhermher 4y agoyeah. 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!)