Ask HN: Are there any downsides of using TypeScript?
I'm looking to hire a front-end engineer for one of my pet projects and thinking about using a TypeScript/React combo. I've never dealt with TS before, so it's hard for me to make a choice. Its type system is what attracts me the most.
Things that I'm specifically interested in:
- Speed of development/heaviness of the language (such as if we'd compare, say, Java vs. Go)
- 3rd party non-TS libraries
- Testing framework
Any help is greatly appreciated![Edit: formatting]
7 comments
[ 9.2 ms ] story [ 37.3 ms ] threadThe 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!
Speeds up development a lot when you have them, though!
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.