Union Types in TS

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
    All the learning resources such as code files, documentations, articles and community discussions are available on our website:
    chaicode.com/
    You can find our discord link, github link etc on the above website.
    Twitter/X link: x.com/hiteshdo...
    Discord link: hitesh.ai/discord
    Learn React with 10 projects: • Let's learn react from...
    Learn Docker: • A practical guide on D...
    Learn Kubernetes: • Complete Kubernetes Co...
    How does a browser works: • How does a browser wor...
    How nodejs works: • How node JS works | En...
    Learn Redux-toolkit: • Learn Redux Toolkit in...
    Learn NextJS: • Nextjs Full stack course
    Learn Typescript: • Why to learn Typescript
    Learn Javascript: • Welcome to new JavaScr...
    Learn React Native: • React Native Mastery: ...
    Learn Zustand: • React state management...
    Learn Golang: • How to get started wit...

Комментарии • 32

  • @HiteshCodeLab
    @HiteshCodeLab  Год назад +4

    Are you aware of new batch of full stack javascript bootcamp ?
    hc.lco.dev/jscamp2

  • @tushar207
    @tushar207 Год назад +3

    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

  • @nobody20022
    @nobody20022 15 дней назад

    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 Год назад +3

    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  Год назад +5

      Don’t worry, this is not my 1st public playlist. JS is done, golang is done, TS will be done too 😁

    • @mohitjain4453
      @mohitjain4453 Год назад

      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 ❤️

  • @Dev-Phantom
    @Dev-Phantom 25 дней назад +1

    very informative thanks for sharing

  • @kiranpoojary493
    @kiranpoojary493 Год назад

    your TS videos make me powerful day by day☺

  • @sagar-tt4ub
    @sagar-tt4ub Год назад

    Another great explanation almost impossible to find somewhere else

  • @whatsappguys2322
    @whatsappguys2322 Год назад

    Sound Quality is Amazing 🔥🔥🔥🔥

  • @ShubhamVsCode
    @ShubhamVsCode Год назад

    Wow this video have so much of knowledge 😍 Learning typescript will pay later

  • @tamoghnadey
    @tamoghnadey 5 месяцев назад

    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 ?

  • @LaveshGarg
    @LaveshGarg Год назад

    Thank you sir for providing such a quality content

  • @kodandareddy9108
    @kodandareddy9108 Год назад +1

    Good one♥

  • @vivekjaiswal2422
    @vivekjaiswal2422 Год назад

    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?

  • @Userkazt
    @Userkazt Год назад

    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?

  • @ankushthakur2177
    @ankushthakur2177 Год назад

    Sir in the last.. I guess we can use Enum Type for strict checking

  • @Dev-Phantom
    @Dev-Phantom 25 дней назад +1

    cool

  • @Maniish.pandey
    @Maniish.pandey 2 месяца назад

    Watching it in June 2024 ❤🔥

  • @YouAndImpact
    @YouAndImpact Год назад

    Great 👍

  • @Priyanka-bd6um
    @Priyanka-bd6um 11 месяцев назад

    Thank you sir :)

  • @VidhanReddyDev
    @VidhanReddyDev 3 месяца назад

    Lets gooo

  • @arunjoshi7885
    @arunjoshi7885 Год назад

    Awesome

  • @anuraggupta1008
    @anuraggupta1008 2 месяца назад

    Day 2

  • @Vikas-dm9uc
    @Vikas-dm9uc Год назад

    ❤❤❤❤❤❤❤

  • @greenshaheen6716
    @greenshaheen6716 Год назад

    never add 70% are not subscribing video during the the video it breaks the focus

    • @HiteshCodeLab
      @HiteshCodeLab  Год назад +4

      At youtube, call for subscribe is creator’s right. Don’t take such small thing away from creators. ❤️

    • @greenshaheen6716
      @greenshaheen6716 Год назад

      @@HiteshCodeLabmy point is move it to at the start plz

  • @robiul1718
    @robiul1718 Год назад

    আপনারা যারা একেবারে নতুন শুদু মাত্র তাদের জন্য সহজ ভাবে (graphic design )
    সবাই কে ঘুরে আসার দাওয়াত রইল। name: Graphics Robiul.
    আশা করি অনেক ভালো কিছু শিখতে পারবেন।