This article explores the concept of runtime type validation in TypeScript and introduces the Zod library as a tool to achieve it. It also discusses the distinction between nominal type systems and structural type systems in TypeScript and provides a workaround to add nominal type support using branded types. Overall, the article highlights the importance of type validation and offers different approaches to implement it in TypeScript.

4m read timeFrom blog.bitsrc.io
Post cover image
Table of contents
Using branded typesUsing a 3rd party library to add runtime validation
1 Comment

Sort: