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:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 â‹… 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 â‹… 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 â‹… 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 2024 â‹… 5 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