TypeScript Fundamentals × Narrowing, Discriminating Unions, and Type Guards
source link: https://syntax.fm/show/455/typescript-fundamentals-narrowing-discriminating-unions-and-type-guards
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
May 9th, 2022
TypeScript Fundamentals × Narrowing, Discriminating Unions, and Type Guards
👇 Download Show✏️ Edit Show Notes
In this Hasty Treat, Scott and Wes talk about TypeScript Fundamentals, including narrowing, discriminating unions, and type guards.
Sentry - Sponsor
If you want to know what’s happening with your code, track errors and monitor performance with Sentry. Sentry’s Application Monitoring platform helps developers see performance issues, fix errors faster, and optimize their code health. Cut your time on error resolution from hours to minutes. It works with any language and integrates with dozens of other services. Syntax listeners new to Sentry can get two months for free by visiting Sentry.io and using the coupon code TASTYTREAT during sign up.
Payments Hub - Sponsor
There are hundreds of payments processing companies out there. Hit up developer.paymentshub.com/syntax to learn more about how Payments Hub Developers not only processes ecommerce and in-person payments, but also boards and underwrites your merchants in as little as 90 minutes. We are currently offering Syntax listeners who become new partners 6 months free data through our Business Reporting API!
Show Notes
- 00:24 Welcome
- 01:35 Sponsor: Sentry
- 02:23 Sponsor: Payments Hub
- 05:21 Intro to TypeScript fundamentals
- 06:28 What is Type Narrowing?
- 09:32 typeof
- 11:58 instanceof
- 13:29 Custom typeguards
- 16:12 this is
- 17:59 discriminated unions
Tweet us your tasty treats
Recommend
-
38
With everyone getting excited about Typescript I thought it'd be fun to do a walkthrough of one of my favorite features, type guards. These are type-safe functions that allow us to assert that an argu...
-
4
Facebook reaches settlement after being accused of discriminating against US workers Facebook is set to pay a civil penalty of $4.75 million ...
-
1
TypeScript 的官方文档早已更新,但我能找到的中文文档都还停留在比较老的版本。所以对其中新增及修改较多的一些章节进行了个人的翻译整理。本篇整理自
-
4
Oyinkansola Awosan Follow I'm a fun techie and passionate technical writer interested in data science, machine learning, cloud engineering, and blockchain te...
-
1
5 Methods to use Type Guards in TypeScriptDifferent ways to narrow the type of an imprecise object to a more specific one.Introduction
-
3
This article shows common patterns to maximize TypeScript's potential for type-safe code. These techniques are all part of the same group, which we call type narrowing. The GitHub repository is available on:
-
1
Typescript 一些令人又爱又恨的内容 — Type Guard、Narrowing Typescript 一些令人又爱又恨的内容 — Type Guard、Narrowing更新日期: 2022-...
-
2
Emotion analysis technologies could be "immature and discriminating," says UK privacy authority Organizations should not use unproven, biometrics-based AI By
-
7
A Tasty Treats Podcast for...
-
2
TypeScript soothes type narrowing pain point TypeScript 5.4, now generally available, preserves type refinements in function closures following last assi...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK