Should You Use TypeScript? 5 Reasons You Shouldn't!

Поделиться
HTML-код
  • Опубликовано: 5 авг 2024
  • There's hundreds of thousands of articles online about what is TypeScript and how to learn TypeScript but I haven't seen that many articles ask the question, Should you use TypeScript?
    Like most complex questions the answer is frustratingly easy: it depends.
    However I figured I'd delve a little deeper into reasons why you might or might not want to use TypeScript.
    Plus I juggle in this video, so I'm pretty sure that makes it a much watch.
    0:00 Intro
    0:50 It depends!
    1:30 Just Learning JavaScript
    2:12 Small team
    2:51 Faster without TypeScript
    3:37 You Don't Want to
    4:16 Type safety
    4:33 Better Tooling
    5:29 Backend engineers
    6:13 Good for big teams
    7:27 You want to!
    7:35 Wrap up
    --
    DISCORD: / discord
    VOTE ON VIDEOS: votey-uppy.vercel.app/
    NEWSLETTER: hswolff.com/newsletter/
    PATREON: / hswolff
    TWITCH: / hswolff11
    TWITTER: / hswolff
    SITE: hswolff.com/
  • НаукаНаука

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

  • @mming_my
    @mming_my 2 года назад +28

    Yes, because I need a job

    • @hswolff
      @hswolff  2 года назад +7

      shit. what a great reason that I forgot lol

    • @parkerAmv
      @parkerAmv 2 года назад

      @@hswolff lol

  • @NBGTFO
    @NBGTFO 2 года назад +5

    Unless you're using Angular, which you shouldn't be unless you're an insignificant cog in the wheels of a big tech company that forces you to, TypeScript is an extra layer of complexity you absolutely don't need.

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

      """
      Unless you're using Angular, which you shouldn't be unless you're an insignificant cog in the wheels of a big tech company that forces you to
      """
      Just out of curiosity, why do you say this? I personally am someone who has experience with React and I'm interested in learning Angular since it looks like it provides a structure which is something that React lacks.
      What would you recommend instead? Rails?

  • @ytboipoi
    @ytboipoi 2 года назад +6

    The only thing I hate about TypeScript is it brings the illusion of types. You just trust your type definitions so much that you forget to actually check their values. In web development we work with APIs which the types are not certain, any abnormalities or changes to the API could break your code entirely. All the effort making those restrictions is nothing but digging your own grave on top of a lie. Scripting language should be versatile and adaptable, and somehow predict the future, not restricted to those types that you imagined.

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

      For those problems I suggest the "zod" module, it plays really nice with TypeScript

  • @hugodsa89
    @hugodsa89 2 года назад +14

    Generally there is an initial overhead but it pays dividends in no time at all

    • @hswolff
      @hswolff  2 года назад +1

      very fair!

  • @jayasurian123
    @jayasurian123 2 года назад +6

    In my team, there are lots of juniors. Forget about TS, getting quality JS with correct test cases itself is a big task. Anyway, I don't like C++.

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

      It's been a year since you wrote this. How did this decision turn out?

  • @gustavostnt
    @gustavostnt 2 года назад +4

    I guess it really comes down to personal preference and needs. You can be type-safe with conditional validation. Maybe even the "guard" approach that Elixir has. The bugs that strict types try to solve can also be solved by good tests. If you think about programming improvement as going from more imperative to more declarative and simpler, you probably see value in dynamic typing and more levels of abstraction. Though, if you think programming should be down to its roots in C/C++ with more tooling and complexity, you probably prefer a larger syntax and are more prone to strict types. This reminds me of both "go to" and "pointers" discussions. You can use low-level languages to build systems and high-level languages to build applications.

  • @jtjt8777
    @jtjt8777 2 года назад

    what is ts industry standard now? I tried eslint airbnb-typescript and it yells at me way way too often. Do people disable rules?

  • @jornejongsma
    @jornejongsma 2 года назад +5

    I hate it and I love it... It was a struggle for me to get to learn Typescript, but when I'm finding out how to do things right in Typescript it just is very satisfying. And I think I'm going to love it even more. At the moment I still have some personal cli scripts that are still not written in Typescript, that is when I actually miss it!

    • @hswolff
      @hswolff  2 года назад +3

      learning curve is def not easy, but yeah when you get over that cliff it becomes great.
      I do find that TS has different levels of complexity. just when I think I understand typescript it throws me for a loop and I have to learn a whole new thing again

    • @jornejongsma
      @jornejongsma 2 года назад +1

      @@hswolff Yep, very recognizable..

    • @hugodsa89
      @hugodsa89 2 года назад

      @@hswolff yeah definitely the meta programming is so good, much like c++ template programming ❤️

  • @eddyk564
    @eddyk564 2 года назад +3

    Thanks for this! I have always been told that Typescript is fantastic, and while I can see its value, I can't find a real reason to use it. The main type issues I have with JS is getting data from elements that are numbers and having to do parseInt() every time so they won't be treated as a string. Other than that, I've never had an issue with JS

  • @franciscokloganb
    @franciscokloganb 2 года назад +2

    My problem with TS is how hard it is to set it up. It is not like using Java, KotLin or C# where everything is there out of the box... Between the config files, npm(whatever) libs and vscode complaining about things that are right and in accordance to documentation, just because you screwed up somewhere in a configuration is a pain in the butt. Python does "typing" right with type hints. You get the same value you get in TypeScript and you do not have to setup jack shit. That being said I much prefer when I arrive at some company project which has TypeScript all set up and ready to go.

  • @alegherix
    @alegherix 2 года назад +7

    The overhead of added Typescript is paid for in tenfolds when you can spot bugs before they happen, aswell as having autosuggest options available due to the type being known.

  • @wolfymaster
    @wolfymaster 2 года назад +4

    I agree with these points. Typescript's value comes from providing consistency and contracts across a large codebase or team. I've also found it valuable to have contracts when the frontend and backend are managed as separate apps. Personally tho - I'm a fan of types and generally prefer typescript over javascript.

    • @hswolff
      @hswolff  2 года назад +2

      Yeah if you're all in on JS on FE and BE then TypeScript is suuuper cool, and the tooling related things you can do there is super super powerful.

    • @wolfymaster
      @wolfymaster 2 года назад

      @@hswolff yup. This is exactly how we designed our application. I'm only sad that I didn't know about next.js when we were doing that.

  • @rhatalos1997
    @rhatalos1997 11 месяцев назад

    "TypeScript will slow you down" is the argument I hear everywhere and can understand the least. When using JavaScript, I spend so much time on looking up API response types and figuring out the value of a variable after chaining many ".map" and ".filter" operations. The main benefit of TypeScript for me is development speed.

  • @slob5041
    @slob5041 2 года назад +1

    Using typescript on a project you considered to be mostly bug-free is a shocking, and satisfying experience after fixing it.

  • @alinawaz4034
    @alinawaz4034 2 года назад +8

    3:08 this is for NOOBS who dont know Typescript When you Know Typescript It is Faster It save time by it prevents silly mistakes when you are on a deadline or you want to ship faster. It save me many times can't tell you But When i was a noob in Typescript it kills me but now it helps me.

    • @toddhoward5947
      @toddhoward5947 2 года назад +1

      True currently learning typescript all those errors irritate me but after solving everything it gives me confidence from now on im only going to use typescript+ react 💜

    • @hswolff
      @hswolff  2 года назад +1

      you're definitely faster when you know TS better!
      but i'd still argue that you can still go faster without TypeScript cuz you're literally doing less! No typing!

    • @hugodsa89
      @hugodsa89 2 года назад

      @@hswolff that’s assuming that you don’t mistype, and always know the shape of every object by memory. Honestly you’d be overconfident and underestimating your capacity to make mistakes. I mean how much slower is it to make an interface or defining return types and argument types, really. If that is what takes long in your development and not the considerations of paradigms and architectural decisions than its probably better to invest into gaining vertical depth, typing has never been the problem. I think I spend 80% of the time thinking and maybe 20% implementing it. But hey, that’s just my opinion on the topic

  • @stefanbogdanovic590
    @stefanbogdanovic590 2 года назад +2

    You should use Typescript, ex. If you are putting types in code you are still using TS because of type inference, and for beginners just add any for now, and later on when you progress come back put Exact type, refactoring is much better in TS than JS, so yea use TS 😁. Harry could you make a video about unit testing components in React/Next TS?

    • @hswolff
      @hswolff  2 года назад +1

      oooh testing is a great topic! thanks for the suggestion! i'll add it to the big ol' list

    • @stefanbogdanovic590
      @stefanbogdanovic590 2 года назад

      @@hswolff You are welcome sir 😁

  • @Fat-totoro-cat
    @Fat-totoro-cat Год назад

    Good video - I use JSDoc myself.

  • @SeanGrimLink
    @SeanGrimLink 2 года назад

    Great video 😉

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

    If developers would just type their JSDoc comments, including documenting types, then plain JavaScript is perfectly fine in my opinion, also for large scale projects. And yes, IDEs such as vsCode do pick that up. But in practice I found that it’s hard to convince developers to consistently type JSDoc. Oh well then let them use their beloved TypeScript, tinker around with WebPack, and make everything way more complex than necessary just to avoid having to type proper documentation. ;)

    • @rhatalos1997
      @rhatalos1997 11 месяцев назад

      I can totally see that library developers using JSDoc and Unit Tests don't need TypeScript. For application code without documentation or tests, TypeScript is a perfect fit.

  • @lovelytingy
    @lovelytingy 2 года назад +1

    currently working it in ts & I 😘 it

    • @hswolff
      @hswolff  2 года назад

      hell yeah :D

  • @dailymeow3283
    @dailymeow3283 2 года назад

    I totally agree

  • @amans6504
    @amans6504 2 года назад +2

    I think you're talking from a senior dev's perspective who have spend time with typed languages before.
    As newbie, i think typescript teaches a lot of stuff, when i was learning js as a newbie, i tried calling a rest api in android kotlin and i was perplexed by the complexity it had compared to js, bcz of types and oops, js ecosystem is unhealthy, it takes away all the object oriented stuff and types, which is not good for junior devs as they might have to face low level languages like golang and rust in future. It leads to script kiddies, im one of them lol trying to do better😬

  • @geomukkath5373
    @geomukkath5373 2 года назад +5

    Here's my beef with TypeScript - whenever I use a 3rd party JS library the documentation is generally in JS. Now to integrate it with something like Angular that uses TS I have to first convert that into TS. Convert every single thing from JS to TS.

  • @Thorax232
    @Thorax232 2 года назад +1

    The only point I agree with on not using it is if you're just learning javascript. Moving fast or playing loose just because you're on a small team is pretty ridiculous.

    • @jtjt8777
      @jtjt8777 2 года назад +1

      how people survive before ts? people did survive so it is not "ridiculous"

    • @Thorax232
      @Thorax232 2 года назад +2

      @@jtjt8777 I'm talking about the justification. Small teams shouldn't have lower standards. And TS did raise the standard for quality like it or not.

  • @sasg87962
    @sasg87962 2 года назад +1

    which one slows down:
    1. func(name: string) ...
    2. func(name) if(typeof name ...)

    • @gustavostnt
      @gustavostnt 2 года назад

      Why do you need to require a string in the first place?

    • @gustavostnt
      @gustavostnt 2 года назад +1

      TypeScript solves a problem that not everyone has.

    • @ScopedMach1ne
      @ScopedMach1ne 2 года назад +1

      @@gustavostnt haha 100% I can see the use of typescript in certain scenarios. but generally the problems people are talking about are not much a problem for me. I am fairly good a debugging code.

    • @ytboipoi
      @ytboipoi 2 года назад +1

      Except the first one is a lie but the second one actually did some secure runtime type checking.

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

      The first 🙃. If ur function expects a string why are u feeding it something else and therefore need to check if it's a string? The only time I use typeof is when it can be both and even then I still have to check which one it is in typescript as well

  • @hugodsa89
    @hugodsa89 2 года назад +2

    I would not use JavaScript had TypeScript not existed personally, I’d probably use something else entirely. Probably C#

    • @hswolff
      @hswolff  2 года назад

      well that's a great reason to use TypeScript! hah!

  • @MrPlaiedes
    @MrPlaiedes 2 года назад +4

    Use typescript if you want to work for a company that wants you to use it because it resembles large monolithic backend languages. They're likely to make other tech decisions for you as well.

  • @Krolex22
    @Krolex22 2 года назад +1

    Without watching - yes, even simple types here and there can help a lot

    • @hswolff
      @hswolff  2 года назад

      yeah! it's great that strict mode is opt-in in that case

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

    If you’re just learning programming don’t use either. Javascript is too easy to mess up. I also really think when you’re starting out it’s best to use statically typed languages.

  • @madvillany420
    @madvillany420 2 года назад +2

    We use anyscript at work

    • @jtjt8777
      @jtjt8777 2 года назад

      way way way too underrated comment

  • @margo2328
    @margo2328 2 года назад +3

    It would be great if they can come up with a C# variation that runs in the browsers, it might use TS behind the scenes to compile down to JS, that way it won't feel like putting a square peg in a round hole, especially when using TS with React.

  • @henry.sanchez
    @henry.sanchez Год назад

    JSDocs works for me.

  • @chiefdan07
    @chiefdan07 2 года назад +1

    TypeScript with strict mode disabled is basically just JavaScript but with the benefits of TypeScript. And TS also not yelling at you all the time.

    • @jtjt8777
      @jtjt8777 2 года назад +1

      have you try adding eslint airbnb-typescript? it yells at you all the time every time. it yells at you for using let instead of const for unchanged variables.

    • @chiefdan07
      @chiefdan07 2 года назад

      @@jtjt8777 Well you’re talking about eslint. It will yell at you if you don’t use a variable the second you create it 😂

    • @hugodsa89
      @hugodsa89 2 года назад

      I much rather have a linter and a compiler complaining to me than a runtime bug that I am unaware and cannot even begin to debug for I don’t even know it’s existence, and my users are the ones getting the bug first hand. The tooling around ts is amazing

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

    I personally don’t like TS because it’s basically useless. Yeah you get the great tools but there’s a ton of noise to deal with. I use it but miss plain old JS

  • @amirnoorani5017
    @amirnoorani5017 11 месяцев назад

    I don't know why people support Over-hyped topics like Typescript and they enjoy to use them without any good reason without asking the question of "Does Typescript really adds value to my project or just overcomplicate things?"

  • @bm830810
    @bm830810 2 года назад +1

    So I write faster with TS since I make many stupid mistakes, TS prevents most of them, if you are the kind of programmer that rarely write bugs, OK go ahead and use JS.

    • @hswolff
      @hswolff  2 года назад +1

      JavaScript is the wild wild west 😈

    • @bm830810
      @bm830810 2 года назад

      @@hswolff haha, yes it is, you can do whatever your wish, its like a utility blade, without the handle :)

  • @Shagidelic
    @Shagidelic 11 месяцев назад

    typescript is not really typesafe like other typesafe languages. if you are coming from typesafe language you will end up expecting TS to act in a certain way a lot, but it will not. TS is limited by the fact that it gets converted to JS which does not support typesafety at all. So all you have is compile time type safety which is again lacking compared to Type safe langages. run time type safety is not there.
    So, bottom line, do not use TS the same way you used typesafe languages. It is just a syntactic sugar which only creates another layer of complexity (of learning how TS gets converted to JS and all the issues that come with it).

  • @justfly1984
    @justfly1984 2 года назад

    Short answer is yes

  • @getteched2412
    @getteched2412 2 года назад

    I did recently, after a lot of procrastinating, learn typescript. It did tale me a good 2 or 3 days to fully understand it but now that I know it, I will never go back :)

  • @paulholsters7932
    @paulholsters7932 2 года назад +1

    I hate it it slows me down

    • @rhatalos1997
      @rhatalos1997 11 месяцев назад

      Could you elaborate how exactly?

  • @caincobain9318
    @caincobain9318 2 года назад

    Don't want to but have to unfortunately (was very happy with my just Javascript code).I ended up in a project already built with ts so now I have to learn it too.

    • @hswolff
      @hswolff  2 года назад

      Yeah...that's a good reason too...."you have to" lol

  • @mrkhoros
    @mrkhoros 2 года назад +1

    The answer is NO.

  • @virajsingh8865
    @virajsingh8865 2 года назад

    off topic comment: your shirt color exactly matches your lip color.

  • @Pietruszkaaa123
    @Pietruszkaaa123 2 года назад

    wassup

  • @pelaoinfo
    @pelaoinfo 2 года назад

    Js+jsdoc rip ts

  • @jexxiewoo8390
    @jexxiewoo8390 2 года назад

    More analysis twitter.com/swyx/status/1350427690814251010?s=21

  • @x6Blade9x
    @x6Blade9x 2 года назад

    If you are making IO applications - dont use typescript.

  • @Maya_ni_Ochiru
    @Maya_ni_Ochiru 2 года назад +1

    And if ur using deno