Everyone these days is forcing typescript. There are so many fans and articles about it. Angular team is making their framework in TS. But my experience with migrating ES6 to TS was very disappointing.
I tried to migrate our relatively fresh codebase (writen in ES6) to Typescript last month and faced a ton of pitfalls!
To be clear, we are talking about node.js application with mocha unit tests and ESLint configured (using babel to transpile).
First of all, to empower type checking I set up noImplicitAny
option,
got hundreds of errors and fixed it. But after that, I got typing errors due to typescript does not understand some node.js predefined modules, like stream
(The problem is actually bigger, due to lack of typings for a lot of modules).
After that, I installed typings
- recommended replacement for tsd
tool for manage library d.ts
files, but it's node
typing definition , while resolving stream
problem, added a lot of errors because it duplicates some predefined types.
In addition, I found out that typescript actually does not compile many features of ES6 into ES5 actually, such as generators. It forced me to make complex build process (TS -> (typescript) ES6 -> (babel) ES5), and it means that I have to waste my original source maps.
All above took a lot of time to configure.
So, I'm confused. I really love the idea behind typescript, but implementation seems so rude to me. I hope I'm wrong.
Maybe someone who used Typescript in real project, not HelloWorld one, could explain me what am I doing wrong?