When to Use TypeScript – A Detailed Guide Through Common Scenarios
This doesn&#x27;t seem like a common occurrence, judging from all the praise of TypeScript sung on this thread and elsewhere, but I&#x27;ve had an overall negative experience working with TypeScript so far.<p>Here&#x27;s some thoughts on what has contributed to that so far:<p>1. TypeScript pushes you towards its own build pipeline (based on tsc) that doesn&#x27;t play nicely all the time with mainstream JS build pipelines (usually based on babel).<p>With babel 7 came @babel&#x2F;preset-typescript, which I hoped would narrow the gap, but so far it&#x27;s very clearly a second class citizen in the TypeScript ecosystem, with new features built only with tsc-based pipelines in mind (Project References is the one that stands out because we sorely need it for our monorepo codebase, but can&#x27;t use because we chose to adopt @babel&#x2F;preset-typescript), and having personally ran into several issues stemming from what seems to be fundamental incompatibilities between tsc and babel that have no real workarounds (here&#x27;s one that I can remember off the top of my head: <a href="https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;babel&#x2F;issues&#x2F;8361" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;babel&#x2F;issues&#x2F;8361</a>).<p>The reason this is so frustrating is TypeScript could have been just a type checker, like Flow. But instead, it had to introduce it&#x27;s own compilation tooling which is still vastly inferior to babel in terms of overall flexibility and extensibility. All of this seems to be due to what I believe are a few fundamentally poorly thought-out decisions at the beginning of the project to allow TypeScript to specify its own language features that have runtime semantics (things like Enums and class visibility modifiers, neither of which are anywhere close to becoming standardized in JS-proper, by the way, and both of which are completely orthogonal to TypeScript&#x27;s main responsibility of type checking), and implementing them using a separate build pipeline instead of as extensions to babel &amp; its own type checker.<p>If I were to use a JS type system for a new project today, I&#x27;d personally choose Flow over TypeScript in a heartbeat because of this.<p>(this is getting a bit long so will continue in a reply)