Awaited with John Chadwick - TypeScript Type Challenges #189 [EASY]

preview_player
Показать описание
Awaited is a nice early look at how recursive types look in TypeScript. Hopefully, by the end of this challenge you are starting to see how powerful TypeScript's type system is. It feels magical if you only see the tests, but if you see a solution it should make more sense.

00:00 description of the challenge
00:34 attempt at a solution
04:45 all tests pass
05:21 alternatives
05:57 RIP FlowType

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

5:19 Type on line 32 can be
type MyAwaited<T extends PromiseLike<any>> = MyAwaitedInternal<T>
No need in additional condition.

6:02 Line 31 can be never instead of T as this line is unreacheble. Any reason to use T there?

QwDragon
Автор

did the challenge's test case got updated? I have this test case: type T = { then: (onfulfilled: (arg: number) => any) => any }. I have to change Promise<unknown> to PromiseLike<any> but I don't like using any.

Lindaine
Автор

i don't really understand what Dimitri was doing at 3:15 when John was still talking, that's when you guys lost me. i was able to understand everything up to that point 😅

FunctionGermany
Автор

When they say this stuff is EASY? EASY TO WHO?😅

mrlectus