Programming

Programming

— Software development, languages, tools, and the craft of building software
1 members Created Sep 2026
dev.to/nyaomaru/how-do-you-validate-unknown-in-typescript-without-a-schema-library-1a11

How Do You Validate `unknown` in TypeScript Without a Schema Library? 🛡️

Writing input as User makes TypeScript stop complaining, but it checks nothing: a payload with name: 123 sails through and blows up at runtime on .toUpperCase(). The fix shown is small composable type guards built with is-kit, which verify the value at runtime and narrow the type in the same step, with no separate schema.

— via dev.to, nyaomaru


No comments yet

Be the first to share your thoughts.