Ask HN: Are there any downsides of using TypeScript?
2 comments
We've been using Typescript (almost) since the day it was released. IMHO, I would never start any decent-sized JS project without it.
The development speed is really good. It of course takes some time to transpile, but we have a live-reloading setup which allows us to see code changes almost instantly. The actual build time will depend on your setup (our projects are usually between 1-5s), but I think the advantages of a type system easily outweigh any build time.
I don't have too much experience with the different test frameworks, but we've used mocha (with chai), and they both work great.
The only real downside is that non-TS libraries will need a definition file to enable typechecking. We don't use too many 3rd party libraries, but most of the popular ones include typescript definitions, and making your own for libraries which don't have them isn't too hard, depending on the size of the library, of course.
In summary, we've not seen any downsides to using TS. The language is a joy to write in, and the type system is so well designed that you can actually avoid writing code in some places by designing your types properly.
I hope this helps!
The development speed is really good. It of course takes some time to transpile, but we have a live-reloading setup which allows us to see code changes almost instantly. The actual build time will depend on your setup (our projects are usually between 1-5s), but I think the advantages of a type system easily outweigh any build time.
I don't have too much experience with the different test frameworks, but we've used mocha (with chai), and they both work great.
The only real downside is that non-TS libraries will need a definition file to enable typechecking. We don't use too many 3rd party libraries, but most of the popular ones include typescript definitions, and making your own for libraries which don't have them isn't too hard, depending on the size of the library, of course.
In summary, we've not seen any downsides to using TS. The language is a joy to write in, and the type system is so well designed that you can actually avoid writing code in some places by designing your types properly.
I hope this helps!
Thanks a lot. This is helpful. I know that you better not avoid type checking, but just curious, when it comes to 3rd party non-TS libraries, I suspect a definition file is just a beneficial option and you can still live without it, is this correct?
Correct. Most popular libraries have them, though. Even if they aren't TS.
Speeds up development a lot when you have them, though!
Speeds up development a lot when you have them, though!
I have not encountered any downsides except very, very minor ones. The upside is MASSIVE and renders those downsides meaningless.
Speed/development heaviness is not an issue because you can skip typing whenever you want and just write ES6+.
Non-TS libraries are easy to import and use. I use one or two, but most libs have type defs available.
Testing is the same as in JS. There are type defs available for the major JS testing suites.
Speed/development heaviness is not an issue because you can skip typing whenever you want and just write ES6+.
Non-TS libraries are easy to import and use. I use one or two, but most libs have type defs available.
Testing is the same as in JS. There are type defs available for the major JS testing suites.
Awesome. I think you even answered the question I asked above. Thank you. Convinced and going to go with TS.
Things that I'm specifically interested in:
Any help is greatly appreciated!
[Edit: formatting]