A beginners guide to Typescript | Collective Literal Types, Widening and Narrowing Types

Sdílet
Vložit
  • čas přidán 1. 06. 2024
  • Check out my Web Development Courses 🔥
    developedbyed.com/
    🛴 Follow me on:
    Twitch: / developedbyed
    Twitter: / developedbyed
    Instagram: / developedbyed
    Github: github.com/developedbyed/
    🔥Dope Tracks
    Mac Kay - Shade chll.to/00509844
    Boukas - Melvin chll.to/10d340df
    less.people - Lamp Glow chll.to/51b47e4a
    Enough Cereals - Suave chll.to/3ce6c324
  • Věda a technologie

Komentáře • 13

  • @developedbyed
    @developedbyed  Před měsícem +3

    Hope you enjoy this series, leave anything you want me to discuss that's typescript related here, so I can talk about them in the next episode 👍
    Fullstack course is halfway filmed as well, it's gonna be huge

  • @IOSALive
    @IOSALive Před měsícem

    developedbyed, This video is fantastic! I liked it a lot!

  • @TiriasCZ
    @TiriasCZ Před měsícem

    8:15 So are we supposed to use only instanceof instead of typeof or are there any cases where we should use typeof?

    • @developedbyed
      @developedbyed  Před měsícem

      Hope this makes it clear typeof expression is the operator that lets you determine the type of expression. typeof evaluates to one of the values: 'string', 'number', 'boolean', 'symbol', 'undefined', 'object', 'function'.
      typeof null evaluates to 'object', thus the correct way to use typeof to detect an object is typeof object === 'object' && object !== null.
      instanceof operator let's identify the instance's constructor. object instanceof Constructor evaluates to true if object is an instance of Constructor.

    • @developedbyed
      @developedbyed  Před měsícem

      Usually use typeof for primitives, cause when you pass it an object, array, null or ehatever it will just give you back “object”
      Whereas with instanceof you can check if you pass an array for ex
      unction isArray(value) {
      return value instanceof Array;
      }
      isArray([1, 2, 3]); // => true
      isArray({ prop: 'Val' }); // => false

  • @billynasir3146
    @billynasir3146 Před měsícem

    I would like to buy your Next JS course but is it getting updated?

  • @encilaj1444
    @encilaj1444 Před měsícem

    Sheesshhh.

  • @johnlayda3299
    @johnlayda3299 Před měsícem

    Shesh

  • @egbaogheneakon4266
    @egbaogheneakon4266 Před měsícem

    Firstttttttt

    • @developedbyed
      @developedbyed  Před měsícem

      you are first and managed to edit your comment, gg

  • @tevfik7
    @tevfik7 Před měsícem

    Why all my fave youtube devs use tsx for react courses? Jsx pls, I barely learned js and now everything is in ts 😂🤦🏻‍♂️