TypeScript The Right Way

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

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

  • @awesome-coding
    @awesome-coding  3 месяца назад +9

    Thanks to Stream for sponsoring this video!
    You can try Stream for Free here: tinyurl.com/get-stream

    • @alinghinea98
      @alinghinea98 3 месяца назад +4

      would you create a tutorial with kotlin and stream integration?

    • @awesome-coding
      @awesome-coding  3 месяца назад +1

      @@alinghinea98 This is actually a good suggestion. Will add it to my todo list - thanks!

  • @BeeBeeEight
    @BeeBeeEight 3 месяца назад +27

    Just to add, besides being a "linter" or JS with types, TS also has variants that are being used in other platforms like AssemblyScript (Wasm), DeviceScript (microcontrollers) and - surprise - Huawei's HarmonyOS and OpenHarmony. It's also first class supported in React Native.

    • @awesome-coding
      @awesome-coding  3 месяца назад +2

      Good points.

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

      AssemblyScript inspired its syntax with that known from TS. In practice, there is no argument for the claim that AssemblyScript is some variant of TypeScript. If one were to succumb to your logic, one would have to say that TS is a variant of C# because they have a convergent syntax and the same inventor.

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

      ​@@coder_one from the docs:
      "AssemblyScript compiles a variant of TypeScript (a typed superset of JavaScript) to WebAssembly using Binaryen."
      You can argue all you want that somehow AS and TS are two very different languages if that makes you feel C# is not TS, but the AS creators beg to differ.

  • @bean_TM
    @bean_TM 3 месяца назад +11

    Node added "experimental-transform-types" which removes limitations of "strip-types" that you mentioned ib 22.7.0

  • @Deathkyun
    @Deathkyun 3 месяца назад +56

    So called "free thinkers" when ": any"

  • @garretmh
    @garretmh 3 месяца назад +4

    Man, even when I’m well familiar with everything covered in one of your videos I like to watch them. They’re just nice, and they’re a good reference for talking with junior devs.

  • @ashleyfreebush
    @ashleyfreebush 3 месяца назад +5

    You convinced me! I am a member!!!

  • @ChichaGad
    @ChichaGad 3 месяца назад +5

    I love you Awesome! ❤️
    Keep up the good work, this channel is one of the best channels for JS and web dev

    • @awesome-coding
      @awesome-coding  3 месяца назад

      Thank you for the nice words! I really appreciate it!

  • @aissa-dev1
    @aissa-dev1 3 месяца назад +6

    I ❤ TypeScript

  • @mikevaleriano9557
    @mikevaleriano9557 3 месяца назад +6

    The typescript subreddit has daily questions from uber smart people: "HOW DO I MAKE THIS SIMPLE CODE COMPLETELY ILLEGIBLE FOR THE SAKE OF USING MULTIPLE LEVELS OF GENERICS JUST TO MAKE ME SEEM SMART"?
    It's exhausting.

  • @ivanmaglica264
    @ivanmaglica264 9 дней назад +1

    Also general, non TS specific coding guide: try to eliminate "else" wherever possible.

  • @bigmistqke
    @bigmistqke 3 месяца назад +2

    7:15 it's kind of annoying typescript doesn't properly account for '' being falsey too

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

    Great video but I am a little bit confused. Isn't it better so said that Typescript is transpiled to JavaScript ?

  • @cocoscacao6102
    @cocoscacao6102 3 месяца назад +4

    JS is more flexible, but that comes with a tradeoff.

  • @MatheusPereira-nn9dj
    @MatheusPereira-nn9dj 3 месяца назад +3

    awsome content !

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

    TypeScript Object Notation = TySON... Ha..ha..ha

  • @josgraha
    @josgraha Месяц назад

    haters gonna bring up some good points, i saw that on a t-shirt in Brooklyn.

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

    1:08
    Who is that guy with such a nice moustache👨🏻?

  • @golang-nerd
    @golang-nerd 3 месяца назад +4

    ThePrimagen mentioned 😄 ruclips.net/video/UMEp6eFU16k/видео.html

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

    typescript is not a fix but a patch

  • @psyferinc.3573
    @psyferinc.3573 3 месяца назад +2

    beautiful

  • @georgehelyar
    @georgehelyar 3 месяца назад +1

    rm -rf node_modules
    done

  • @yashasmn245
    @yashasmn245 3 месяца назад +2

    If video published few mins ago, how come comment is 18 hours ago
    Scheduled messages !?
    But love your vids

    • @awesome-coding
      @awesome-coding  3 месяца назад +4

      Hey! It was published early for chanel members 👍🏻

  • @wwloyd
    @wwloyd 3 месяца назад +2

    I just cant stand overly verbose and way too much complexed TS in codebase, keep it simple is the most important takeaway from this video

    • @awesome-coding
      @awesome-coding  3 месяца назад

      Yep! It clearly is a developer problem, not a language problem. TS allows you to be as flexible as you want, but some people just love extremely complex types.

  • @ulrich-tonmoy
    @ulrich-tonmoy 3 месяца назад +5

    its hightime they add the type in js itself

    • @petaflop3606
      @petaflop3606 3 месяца назад +1

      what's the point? js has deep commitment to backwards compatibility. Which means any type system would be opt in. Which is what typescript is

    • @awesome-coding
      @awesome-coding  3 месяца назад +3

      Sadly I don't think this is going to happen.
      JSDoc is the most we can have.

    • @ulrich-tonmoy
      @ulrich-tonmoy 3 месяца назад

      @@awesome-coding it could improve the performance and they can do if theres no type annotated code it should be considered any that way it wont break compatibility.
      one of the reason why they wont is probably typescript own by ms i guess

    • @christian-schubert
      @christian-schubert 3 месяца назад

      My thoughts EXACTLY, THANK YOU for pointing this out! Typescript has always felt like a half-baked crutch to me...
      I'm all for introducing a statically typed JavaScript option, but it's time we went all in, analogous to the likes of Java, C++, etc., offering specific variable type naming like "string", "int", "double", "bool", "void" alongside "Const", "let", "var" and "function" instead of awkwardly postfixing types the way Typescript does it

    • @youarethecssformyhtml
      @youarethecssformyhtml 3 месяца назад +1

      ​@@christian-schubertI'm totally the opposite. I love postfixing types like in Rust. It's much better to think about the name of the variable first, then type it. I literally hate languages that prefix types

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

    I just wish that typescript was like python or php, in that it's optional to define types, but it doesn't enforce it. It's nice to have, but when it nags you on the smallest variables it ruins the fun for me.

    • @awesome-coding
      @awesome-coding  3 месяца назад +1

      Python and PHP are dynamically typed, just like JS. TS tries to alleviate that by enforcing some type safety.

  • @watchchat
    @watchchat 3 месяца назад +2

    Hahahahha what’s in the box

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

    Please learn about the real difference between types and interfaces and release a video where you accept your mistake

    • @alinghinea
      @alinghinea 3 месяца назад +2

      What mistake? Maybe he could have completed with a difference that a type cannot be re-opened to add new properties vs an interface which is extendable

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

      @@alinghinea yes and while talking about the difference between type and interface in typescript, omitting this shows person does not understand

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

    we got baited, i though this was about typescript.

  • @hazfrd
    @hazfrd 3 месяца назад +2

    Why in the world someone use typescript man, it should be only applied for library and use jsdocs for the rest of your jscode in case needed

  • @lengors7327
    @lengors7327 3 месяца назад +1

    If you dont know the shape of the type you should use (drumrolls please)... unknown. There's 0 reasons to use any at this day and age in typescript, prove me wrong

    • @awesome-coding
      @awesome-coding  3 месяца назад +1

      I fully agree :D That's what I said in the video.

    • @zayne-sarutobi
      @zayne-sarutobi 3 месяца назад

      There actually is, check out Matt's article on that...

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

      @@zayne-sarutobi I agree with first one. Though that one is quite a bit exceptional. It's similar to `T extends any`, it doesn't actually disable typescript in the same way declaring a variable as `any` does, as typescript will make the generic as specific as possible when used. But, fair enough.
      As for the second use case, I'm not convinced. Imo it's a sign of bad design. For his specific example you can achieve the same behavior without actually using any casts.

  • @ohhellothere17
    @ohhellothere17 3 месяца назад +5

    Also typescript, 'any', 'unknown', 'never' 🫠

    • @thegreatxc
      @thegreatxc 3 месяца назад +4

      "never" is actually shockingly useful, so is "unknown" to be fair.

    • @carneloot
      @carneloot 3 месяца назад +7

      The only problem here is any, which basically defeats the purpose of using typescript. Unknown and never are useful tools to build safer and better types

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

      @@carneloot exactly!