Loading video...

Video Failed to Load

Go Home

Here's two TypeScript tips rolled into one: 1. TypeScript magic is everywhere, even in Node's built-in types 2. I bet you didn't know this was legal TS: error: [message: string]

80,986 views • 1 year ago •via X (Twitter)

10 Comments

Matt Pocock's profile picture
Matt Pocock1 year ago

My course is 30% off right now!

vaibhav - oss/acc's profile picture
vaibhav - oss/acc1 year ago

wait this was so easy!!. 2yrs ago i use to copy over this to every project

Corey Ward's profile picture
Corey Ward1 year ago

I did not know that you could name the items in a tuple type. Gonna go fix some that I have that are less than clear right now!

Matt Pocock's profile picture
Matt Pocock1 year ago

Great for things like: type Position = [x: number, y: number, z?: number]

Nathan🔶Tarbert's profile picture
Nathan🔶Tarbert1 year ago

That error type trick is defs something I would've never guessed, Matt's got all the good stuff lol

Artem Zakharchenko's profile picture
Artem Zakharchenko1 year ago

This has to be new! Nice to see this. Alas, no strongly-typed events for EventTarget in lib.dom. That's why I built Rettime ( That and also a bunch of other reasons.

Twilight's profile picture
Twilight1 year ago

How strange, I just discovered this yesterday accidentally 😂😂

Raman Paulau's profile picture
Raman Paulau1 year ago

Vue uses this exact pattern for component defineEmits.

millcake's profile picture
millcake1 year ago

Bruh... U trying to sell ur course talking about basic things Rly?

DJ Molehill's profile picture
DJ Molehill1 year ago

TypeScript out here making tuples feel like dark arts. 🧙‍♂️🌀

Related Videos