Conditional Types - Advanced TypeScript

  Рет қаралды 38,317

Dmytro Danylov

Dmytro Danylov

Күн бұрын

Пікірлер: 38
@billmcbungabine9404
@billmcbungabine9404 3 жыл бұрын
I've been searching for more advanced lessons covering typescript for a while and these are by far the best i've found and they are explained very well especially considering by the sounds of it English is not your native language - well done hope you release more content like this
@DmytroDanylov
@DmytroDanylov 3 жыл бұрын
Thank you
@tigrankhachaturian8983
@tigrankhachaturian8983 3 жыл бұрын
Just read the docs, lol. They work most of the time, though, rarely I have to search external resources about a certain topic that typescript docs fail to explain to me and then return to docs to get a more advanced knowledge.
@tigrankhachaturian8983
@tigrankhachaturian8983 3 жыл бұрын
Oh, I just spotted myself in the comments 4 months later rewatching the same tutorial, nice
@burnCS
@burnCS 4 жыл бұрын
One of the best tutorials about conditional types. Can't wait for more videos :)
@pjeet4411
@pjeet4411 2 жыл бұрын
This is great tutorial on advanced Typescript. I had pause in every 10mins to understand different type of format the extends take like type comparison, function comparison and tuple comparison.
@bradyfractal6653
@bradyfractal6653 2 жыл бұрын
Your channel is a gold mine!! You’re a very talented teacher 💙
@dawid_dahl
@dawid_dahl Жыл бұрын
Thanks so much for providing more advanced TS content for free.
@v23452
@v23452 2 ай бұрын
Hi, Dmytro! Thanks for sharing the knowledge on a more advanced topic.
@v23452
@v23452 2 ай бұрын
May I ask your advice as to where I could possibly find a community of developers helping with TypeScript problems. Is there a Discord room or Slack channel or any other chat to ask questions and get quick answers?
@孙凌峰-w7b
@孙凌峰-w7b 3 жыл бұрын
15:04 what is different between 'type StringNot = T extends 'a'|'b' ? T :never' and 'type MyStringNot = [T] extends ['a'|'b'] ? T :never' . I still don't understand .
@abrahamjones3635
@abrahamjones3635 2 жыл бұрын
It became non-distributive when using [ ] brackets, unlike the first example which was distributive. When the type is not-distributive it means that the whole union type will be compared to the whole of the other union type as if both types were one big type. If the type is distributive (first example), then each type in the generic will be compared to each type to see if it exists in the union. So in the first example if T was 'a'|'b|'c'' then StringNot would result in 'a'|'b' because 'a' and 'b' are both in 'a'|'b', in the second example if T was 'a'|'b'|'c' , then MyStringNot would result in never because 'a'|'b'|'c' does not equal 'a'|'b'. In the second example if T was 'a' then MyStringNot would be 'a' because all the values for T are possible values in MyStringNot. To simplify, if a conditional type is not distributive it will return false if the one of the unions has a type that is not present I the other, else it will return true and all matching values will be returned in the type. Hope this helps!
@nazaka9904
@nazaka9904 2 жыл бұрын
Дякую за туторіал. Добре описана теорія, але хотілося б більше прикладів прикладного використання
@drago8701
@drago8701 3 жыл бұрын
Thanks for the clear explanation
@laniquo
@laniquo Жыл бұрын
This was very helpful. Thank you!
@ikrammissaoui2272
@ikrammissaoui2272 5 ай бұрын
Amazing !
@RachidBoukotos
@RachidBoukotos 4 жыл бұрын
thank you very much, it's really informative
@sunstrike8943
@sunstrike8943 4 жыл бұрын
More about typescript please
@hirisraharjo
@hirisraharjo 3 жыл бұрын
Great video! Subscribed!
@santosharakere
@santosharakere 4 жыл бұрын
Excellent demo, thanks.
@jacinyan3893
@jacinyan3893 3 жыл бұрын
Just started learning TS, and I have been confused about the ‘extends’ keyword in here with say, interface/classes. Now it is kinda explained
@codewithnws3544
@codewithnws3544 10 ай бұрын
hey can you please create the video for infer?
@harini3191
@harini3191 2 жыл бұрын
Can u make more videos on typescript like this? , thanks
@darkknight500
@darkknight500 3 жыл бұрын
Wow! Amazing tutorial ❤ . Thanks for sharing your understanding it greatly appreciated.
@aditya.ishan27
@aditya.ishan27 4 жыл бұрын
Loved it..
@bakaleisanich
@bakaleisanich 4 жыл бұрын
Будут ли курсы по базовому тайпскрипт?
@DmytroDanylov
@DmytroDanylov 4 жыл бұрын
На сегодняшний день, у меня есть платный курс на Udemy по использованию TypeScript в React, в который входит модуль по базовому TypeScript. Вот ссылка: www.udemy.com/course/react-with-typescript/?referralCode=1816455EA4C12F9CA9F4 Пока что записывать видео для канала исключительно по базовому TypeScript не планирую, но будут видео, в которые входит использование TypeScript. Спасибо за вопрос.
@sourishdutta9600
@sourishdutta9600 4 жыл бұрын
You are too good :) make more videos like this
@dimitargetsov9690
@dimitargetsov9690 2 жыл бұрын
Dear Sir, at 22.44: type ReturnTypeany>=T extends(...args:any)=>infer R?R:any; should be,IMAO, : type ReturnType=T extends(...args:any)=>infer R?R:any; Do You need (and why) to write that generic type T any> in the parameter list of ReturnType? Best regards.
@Boris1990ua
@Boris1990ua 3 жыл бұрын
Good stuff, but what about practical use chases?
@DmytroDanylov
@DmytroDanylov 3 жыл бұрын
Thanks, conditional types are quite frequently used. You can look into the type definitions of your favourite libraries and most probably you’ll find some advanced examples for solving a particular typing problem. I think most recently I’ve seen conditional types in react-hook-form.
@akitmentorconsultant4696
@akitmentorconsultant4696 3 жыл бұрын
Thanks a lot 👍
@abdremo
@abdremo 3 жыл бұрын
Thanks
@ankitshukla185
@ankitshukla185 3 жыл бұрын
I have an interface defined as interface Xyz { abc?: string; } I do not know what ?: means here. Can anyone help?
@gabiold
@gabiold 3 жыл бұрын
Probably you are already figured out, but for those who don't: The colon is just the separator between the type and the identifier, the question mark marks the member as optional. So a type that has an "abc" member and it is of type string it fulfills the interface. If it does not have a member "abc" at all, it also fulfills it. But, if you give a type which has a member "abc", but it is not of type string, it then does not fulfills the interface. It is useful if your function that receives the Xyz interface does not require abc to be supplied, for example because it can do some default action without it, but if it is, then it should be of a certain type.
@amoshnin
@amoshnin 4 жыл бұрын
Spasibo
@adiscivgin745
@adiscivgin745 2 жыл бұрын
Hi all, if someone may help I would appreciate it. I have this interface: export interface StorageModuleConfig { appName: string; perUser?: boolean; authPrefixKey?: string; } My task is to make authPrefixKey required only and only if user provide value for perUser property.
@olga-angel
@olga-angel 2 жыл бұрын
Для чого робити відеоуроки англійською, коли їх і так океан... Робіть українською, своє українське море.
Utility Types - Advanced TypeScript
35:33
Dmytro Danylov
Рет қаралды 70 М.
Are your TypeScript Unions broken? | Advanced TypeScript
7:36
Andrew Burgess
Рет қаралды 8 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
No BS TS #18 - Conditional Types in Typescript
11:40
Jack Herrington
Рет қаралды 17 М.
Unleashing Conditional Types - David Nicholas
19:29
UtahJS
Рет қаралды 72
Mapped Types - Advanced TypeScript
12:16
Dmytro Danylov
Рет қаралды 43 М.
Learn TypeScript Generics In 13 Minutes
12:52
Web Dev Simplified
Рет қаралды 294 М.
Generic Classes in Typescript
11:15
Hitesh Choudhary
Рет қаралды 12 М.
I Cannot Believe TypeScript Recommends You Do This!
7:45
Web Dev Simplified
Рет қаралды 179 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 187 М.
7 Awesome TypeScript Types You Should Know
8:57
Josh tried coding
Рет қаралды 90 М.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 219 М.