Conditional Types - Advanced TypeScript

preview_player
Показать описание
A conditional type (T extends U ? X : Y) in TypeScript selects one of two possible types based on some condition.

👨‍🏫 Take a QUIZ to solidify the information you've got from this video:

Table of Contents:
00:05 Conditional type definition
00:55 A basic example
01:57 Deferred evaluation of a conditional type
05:22 Nested expression
06:19 Distributive conditional types and using a conditional type with the "never" type for filtering union types
11:40 When a conditional type is not distributive
15:38 Type inference in conditional types
22:36 Other utility types which use a conditional type

👨‍💻 My Udemy Course:
Using TypeScript with React
Рекомендации по теме
Комментарии
Автор

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

billmcbungabine
Автор

Thanks so much for providing more advanced TS content for free.

dawid_dahl
Автор

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.

pjeet
Автор

One of the best tutorials about conditional types. Can't wait for more videos :)

burnCS
Автор

Hi, Dmytro! Thanks for sharing the knowledge on a more advanced topic.

v
Автор

Your channel is a gold mine!! You’re a very talented teacher 💙

bradyfractal
Автор

15:04 what is different between 'type StringNot<T> = T extends 'a'|'b' ? T :never' and 'type MyStringNot<T> = [T] extends ['a'|'b'] ? T :never' . I still don't understand .

孙凌峰-wb
Автор

Дякую за туторіал. Добре описана теорія, але хотілося б більше прикладів прикладного використання

nazaka
Автор

Just started learning TS, and I have been confused about the ‘extends’ keyword in here with say, interface/classes. Now it is kinda explained

jacinyan
Автор

thank you very much, it's really informative

RachidBoukotos
Автор

Wow! Amazing tutorial ❤ . Thanks for sharing your understanding it greatly appreciated.

darkknight
Автор

Can u make more videos on typescript like this?, thanks

harini
Автор

Dear Sir, at 22.44:
type ReturnType<T extends(...args:any)=>any>=T extends(...args:any)=>infer R?R:any;
should be, IMAO, :
type ReturnType<T>=T extends(...args:any)=>infer R?R:any;
Do You need (and why) to write that generic type T <T extends (...args:any)=>any>
in the parameter list of ReturnType?
Best regards.

dimitargetsov
Автор

hey can you please create the video for infer?

codewithnws
Автор

Good stuff, but what about practical use chases?

Borisua
Автор

You are too good :) make more videos like this

sourishdutta
Автор

Будут ли курсы по базовому тайпскрипт?

bakaleisanich
Автор

I have an interface defined as
interface Xyz {
abc?: string;
}
I do not know what ?: means here. Can anyone help?

ankitshukla
Автор

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.

adiscivgin
Автор

Для чого робити відеоуроки англійською, коли їх і так океан... Робіть українською, своє українське море.

olga-angel