2022-02-01
2640
#typescript
Sneh Pandya
90351
Feb 1, 2022 â‹… 9 min read

Methods for TypeScript runtime type checking

Sneh Pandya Exploring the horizon with a knack for product management. Co-host of the NinjaTalks podcast and community organizer at Google Developers Group. Explorer, adventurer, traveler.

Recent posts:

master state management hydration Nuxt usestate

Nuxt state management and hydration with useState

useState can effectively replace ref in many scenarios and prevent Nuxt hydration mismatches that can lead to unexpected behavior and errors.

Yan Sun
Jan 20, 2025 â‹… 8 min read
React Native List Components: FlashList, FlatList, And More

React Native list components: FlashList, FlatList, and more

Explore the evolution of list components in React Native, from `ScrollView`, `FlatList`, `SectionList`, to the recent `FlashList`.

Chimezie Innocent
Jan 16, 2025 â‹… 4 min read
Building An AI Agent For Your Frontend Project

Building an AI agent for your frontend project

Explore the benefits of building your own AI agent from scratch using Langbase, BaseUI, and Open AI, in a demo Next.js project.

Ivaylo Gerchev
Jan 15, 2025 â‹… 12 min read
building UI sixty seconds shadcn framer ai

Building a UI in 60 seconds with Shadcn and Framer AI

Demand for faster UI development is skyrocketing. Explore how to use Shadcn and Framer AI to quickly create UI components.

Peter Aideloje
Jan 14, 2025 â‹… 6 min read
View all posts

3 Replies to "Methods for TypeScript runtime type checking"

  1. One big downside to io-ts and similar libraries, is all your types are inferred.

    This has some major drawbacks compared with literal types: there is nowhere for you to write documentation – or at least nothing that will be visible to IDE auto completion or a documentation generator. Also, error messages may be very difficult to understand – they aren’t going to point to a specific member, but instead to a complex stack of derived types. And lastly, no automated (remame) refactorings or “find usages” will be available, so you miss out on a lot of the productivity aspects of TS.

    I had high hopes for this approach, but I eventually ended up writing both validators and proper types anyhow, meaning a lot of duplication. Just something to consider before selecting this approach.

Leave a Reply