Union Types in TS

  Рет қаралды 15,995

Hitesh Choudhary

Hitesh Choudhary

Күн бұрын

Пікірлер
@HiteshCodeLab
@HiteshCodeLab 2 жыл бұрын
Are you aware of new batch of full stack javascript bootcamp ? hc.lco.dev/jscamp2
@tushar207
@tushar207 Жыл бұрын
I have been an angular developer and worked with TS from the past 5 years, still there were a few things to take away from this video. Great work Hitesh
@AashishKumar-vb3qb
@AashishKumar-vb3qb 26 күн бұрын
No one can explain union working with other data objects as perfectly as Hitesh explains in this video.
@kiranpoojary493
@kiranpoojary493 2 жыл бұрын
your TS videos make me powerful day by day☺
@nobody20022
@nobody20022 4 ай бұрын
Summary: Union type allows a variable to hold one of several specified types. It’s denoted by using the vertical bar (' | ') between types. This is useful when you want to allow multiple types for a single value, while still maintaining some level of type safety. Syntax: let value: string | number;
@mohitjain4453
@mohitjain4453 2 жыл бұрын
You are doing great Job but please please please complete this Typescript series and provide us all the topics available in Typescript, please do not stop this Typescript series after some videos 🙏🙏
@HiteshCodeLab
@HiteshCodeLab 2 жыл бұрын
Don’t worry, this is not my 1st public playlist. JS is done, golang is done, TS will be done too 😁
@mohitjain4453
@mohitjain4453 2 жыл бұрын
Thanks Hitesh 🙂 I have purchased your Angular course and Vue JS course from LCO and also going to purchase React JS course, I love your teaching style ❤️
@sagar-tt4ub
@sagar-tt4ub 2 жыл бұрын
Another great explanation almost impossible to find somewhere else
@Dev-Phantom
@Dev-Phantom 4 ай бұрын
very informative thanks for sharing
@ShubhamVsCode
@ShubhamVsCode 2 жыл бұрын
Wow this video have so much of knowledge 😍 Learning typescript will pay later
@HiteshCodeLab
@HiteshCodeLab 2 жыл бұрын
Absolutely
@kodandareddy9108
@kodandareddy9108 2 жыл бұрын
Good one♥
@HARSHKUMAR-g2d6u
@HARSHKUMAR-g2d6u 2 ай бұрын
I'm like the video before watching because i know that its good video and helpful
@tamoghnadey
@tamoghnadey 9 ай бұрын
what if we do this - function getDBId(id: number | string) { // console.log(`db id is ${id}`); if (typeof id === "string") { id.toLowerCase(); } else { id = id.toString(); id += 1; } } when we are converting id to string in the else block it still allows us to add 1 to it in the next loc ideally we should not be able to do that, we can't add number to a string How can we avoid that? Or is it a flaw ?
@vivekjaiswal2422
@vivekjaiswal2422 2 жыл бұрын
There are two types of data types we can mention for any variable, either lowercase (number) or uppercase(Number). Mostly we will use lower case one, So why can't we go for upper case?
@LaveshGarg
@LaveshGarg 2 жыл бұрын
Thank you sir for providing such a quality content
@HiteshCodeLab
@HiteshCodeLab 2 жыл бұрын
You are welcome
@ankushthakur2177
@ankushthakur2177 Жыл бұрын
Sir in the last.. I guess we can use Enum Type for strict checking
@mdmostafizurrahman9275
@mdmostafizurrahman9275 Ай бұрын
if i have to check using condition then what the need of TS ? if (typeof id === "number") { return id + 10; } else if (typeof id === "string") { return id.toUpperCase(); }
@ZizouZ5
@ZizouZ5 Ай бұрын
there's no need for else or else if check here because ts is smart enough to infer the only remaining type 'string' for the id variable
@Maniish.pandey
@Maniish.pandey 6 ай бұрын
Watching it in June 2024 ❤🔥
@Userkazt
@Userkazt 2 жыл бұрын
type User= { username:string; role:string; } type Admin = { role:string; sudo:boolean; } let uncleBob : User | Admin = { username: 'uncle',role:'user',sudo:false} console.log(uncleBob) In this case, instead of User or Admin, it has combined both types of data into one. Is this a problem?
@YouAndImpact
@YouAndImpact 2 жыл бұрын
Great 👍
@arunjoshi7885
@arunjoshi7885 2 жыл бұрын
Awesome
@Priyanka-bd6um
@Priyanka-bd6um Жыл бұрын
Thank you sir :)
@vidhan-dev
@vidhan-dev 6 ай бұрын
Lets gooo
@Vikas-dm9uc
@Vikas-dm9uc 2 жыл бұрын
❤❤❤❤❤❤❤
@Dev-Phantom
@Dev-Phantom 4 ай бұрын
cool
@anuraggupta1008
@anuraggupta1008 6 ай бұрын
Day 2
@greenshaheen
@greenshaheen 2 жыл бұрын
never add 70% are not subscribing video during the the video it breaks the focus
@HiteshCodeLab
@HiteshCodeLab 2 жыл бұрын
At youtube, call for subscribe is creator’s right. Don’t take such small thing away from creators. ❤️
@greenshaheen
@greenshaheen 2 жыл бұрын
@@HiteshCodeLabmy point is move it to at the start plz
@robiul1718
@robiul1718 2 жыл бұрын
আপনারা যারা একেবারে নতুন শুদু মাত্র তাদের জন্য সহজ ভাবে (graphic design ) সবাই কে ঘুরে আসার দাওয়াত রইল। name: Graphics Robiul. আশা করি অনেক ভালো কিছু শিখতে পারবেন।
Tuples in typescript
9:53
Hitesh Choudhary
Рет қаралды 14 М.
Discriminated Union and Exhaustiveness Checking with never
11:24
Hitesh Choudhary
Рет қаралды 6 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Interface in typescript
9:55
Hitesh Choudhary
Рет қаралды 20 М.
Generics in Array and Arrow functions in Typescript
8:15
Hitesh Choudhary
Рет қаралды 10 М.
READONLY and optional in typescript
9:51
Hitesh Choudhary
Рет қаралды 24 М.
Generics in Typescript
12:28
Hitesh Choudhary
Рет қаралды 22 М.
Generic Classes in Typescript
11:15
Hitesh Choudhary
Рет қаралды 12 М.
Instanceof and Type Predicates
9:24
Hitesh Choudhary
Рет қаралды 9 М.
Security for your Backend Application | Arcjet
32:53
Hitesh Choudhary
Рет қаралды 15 М.
Type Narrowing in typescript
9:54
Hitesh Choudhary
Рет қаралды 10 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН