TypeScript 5.3 is a no-brainer upgrade

preview_player
Показать описание
00:00 Intro
00:28 Import Attributes
01:21 switch (true) Narrowing
02:54 Interactive Inlay Hints

Become a TypeScript Wizard with my free beginners TypeScript Course:

Follow Matt on Twitter

Join the Discord:

Рекомендации по теме
Комментарии
Автор

For those stumbling in late, I missed this feature for this video because it wasn't mentioned in the release notes:

mattpocockuk
Автор

sick animations in this video, well done

blizzy
Автор

Matt, your tutorials are consistently so clear, polished And easy to follow. thank you 🙇

CodeWithMario
Автор

Upgrading Typescript _should_ be very little hassle, but unfortunately we're still stuck on older versions because of dependencies claiming not to support Typescript greater than x version... \*sigh\*

Svish_
Автор

I'm confused by switch true narrowing as it's a handy hack in JS but could they not have backed an actual pattern matching spec?

struggopuggo
Автор

Inlay hints is a feature that the rust language server has had for a while. I've been wondering when other languages would gain the same thing.

Metruzanca
Автор

Psyched for your book. Always appreciate these quick updates Matt!

RefactoringRyan
Автор

Great content!
I did notice some lip-sync issues at the end of the clip.

magnusmarkling
Автор

With the switch(true) in order for people to usually get the "right" type out, usually I have instead done a typeguard to assert it first and then return it.
It is more cumbersome, but it is also accurate and can easily be put on multiple small functions that can also be reused later on.

Thanks for sharing :)

hugodsa
Автор

Why would someone return from an if statement then add "else if" below? "if return" pattern is more clean and easy to read solution then switch!

prionkor
Автор

All great features. Thanks for the breakdown as usual Matt.

Metruzanca
Автор

Thank you very much. Good explanations and good video!!! I have subcribed.

HerrThomasE
Автор

2:50 why not do `switch (typeof input)`?

divy
Автор

from early, to now we are almost at the mid typescript times (x.5 to x.7 release)

and now typescript 4 seems so last year

Dev-Siri
Автор

I'm really confused by the `switch(true)`, I would never have thought of using a `switch` like that, or even put `true` in the `switch`. What are the benefit over something like:
```ts
switch ( typeof input ) {
case 'string':
case 'number':
return ( input );
case 'object':
return ( !! input ? input : undefined );
}
```

KuroBayashi
Автор

Using switch true should be a crime with a 10 years in jail penalty

zwanzr
Автор

that switch should be "switch (typeof input) ..."
what about this? does it work with type narrowing?

FunctionGermany
Автор

inlay hints 🔥
Home sweet home rust devs

patrick.miharisoa
Автор

With query parameters you can have an env.d.ts file define them (e.g., `declare module "*.svg?url" { ... }`), how would that work with import asser- attributes?

Brawaru
Автор

Why two return points in the switch(true) example? Why not just add a third case to one single return block?

rcnhsuailsnyfiue