News for hackers. Stuff that matters.
Re:A 'CSS reset' for TypeScript, improving types for common ... by jcparkyn on Friday March 03, 2023 @03:51AM (#35007287)
One advantage is that unknown makes it clear at a glance where the unsafe cast is happening, and forces devs to do it in a reasonable place (rather than letting `any` propagate through the code accidentally).

Personally though, I think vscode should have a feature to automatically highlight `any` variables is TS code, which would serve roughly the same purpose.

As another commenter mentioned, this is much better when using something like Zod to do the cast safely.

There are no comments on this comment yet.