Typescript Turns 10: The Future of JavaScript with Native Type Support
- Aditya Jadoun
- Mar 14, 2022
- 2 min read
Typescript is hitting the decade mark this October. It began as a tool for corporate behemoths, but now it's beloved by even the trendiest developers—picture that guy with a man bun, sipping a soy latte, and coding on his M1 MacBook. The State of JavaScript survey showed that types are the number one feature people wanted, as they help catch bugs before they hit production. However, the build step, where Typescript code is transpiled back into vanilla JavaScript, remains a universal pain point. It’s time-consuming and requires dealing with pesky configuration details.
Imagine a world where Typescript just worked in the browser without a build step. This dream could become a reality. The Typescript team has proposed adding native types to the ECMAScript standard, which could integrate directly into JavaScript. But don’t get too excited yet—this proposal is only at stage zero. It has a long journey through four stages before it can be officially part of the standard, and many proposals never make it.
Back in the early 2000s, a similar idea for a type system in JavaScript, ES4, was scrapped due to disagreements, leading to the release of ES5 instead. Today, Typescript gives us a glimpse of what a type system for JavaScript could look like. But this doesn’t mean every browser and runtime like Node.js will need to implement the Typescript compiler. Instead, the proposal suggests a clever workaround: using types as comments in JavaScript. These comments would be ignored by the browser but used by tools like Typescript, Flow, and IDEs to provide enhanced developer experience. This non-invasive approach could integrate types without disrupting the existing JavaScript ecosystem.





Comments