Are you a TypeScript user?
Your initial reaction may be a resounding “Yes!”
Or perhaps be a booming “No!”
The answer seems simple, but (as with most things) it might be more nuanced than you think.
Here’s Anders Hejlsberg, TypeScript Co-Creator & Lead Architech, from the TypeScript documentary:
It’s easy to think of “TypeScript” as “the syntax”. Either you use TypeScript and write
.ts files, or you shun TypeScript and exclusively write
But, to Anders’ point, if you write
.js files in VSCode you’re “using TypeScript” because there’s more to TypeScript than just syntax: there’s TypeScript the syntax and then there’s TypeScript the tool.
.d.ts files. Or it can do all three at once from different files in the same repository — all to make that information useful to the VSCode user.
That’s sort-of the beauty of TypeScript: you can use the flavor that works for you.
If you’re keen on writing code as it will be run, you can still “use TypeScript” without a compilation step (write JS in VSCode, for example).
Here’s Ryan Cavanaugh, TypeScript Engineering Lead, from the same documentary:
When I hear about big projects like Svelte and Webpack only using JSDoc, some people look at that and say, “Oh they’re moving away from TypeScript.” But I say, “No they’re embracing TypeScript. They’re embracing this other flavor of TypeScript that we’ve made.”
What stood out to me from the documentary was how members of the TypeScript team note that, with things like the type annotations proposal, the days of writing
.ts files might actually be numbered.
Eventually, “using TypeScript” could merely become running a CLI over your
.js files and making sure everything checks out. You wouldn’t have to do that, you could skip that step entirely and run your code without any analysis, but you could also run it for safety’s sake — a kind of “compiler via comments”.
That's what the proposal could bring, which intrigues me because it shows how the TypeScript team is aiming to make the
.js aspect of the tool follow the steps of Sass or jQuery: a tool making itself obsolete by disappearing into the web platform.