Frontend First cover image

Frontend First

Lying in TypeScript

Jan 26, 2023
47:54

Podcast summary created with Snipd AI

Quick takeaways

  • TypeScript programs can have lies slip in when assuming accurate types from external systems, so handling lies at the boundaries of code is crucial for type-safety.
  • Validating incoming data at the boundaries of code is important to prevent lies and ensure expected types, and tools like zod can help handle changes and drift in external system types.

Deep dives

Understanding the potential lies in TypeScript

When using TypeScript with external systems, such as APIs or legacy systems, it's important to be aware of the potential lies that can slip into your code. These lies occur when you assume the types that are being provided to you are accurate, but they can drift or change over time. It's crucial to handle these lies at the boundaries of your code by using appropriate validation and type inference tools. One such tool is zod, which allows you to define validation schemas and extract inferred types. By keeping the types close to the boundaries and reducing the number of lies in your code, you can ensure a more type-safe and robust system.

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode