Work can be a fun when we know and understand each other well. Let's start conversation to new beginning
+91 63542 35108
To discuss what we can do for you Give us a Call
Tell us about your next project Write to us
Before we get into what this proposal is and what it plans to accomplish, let’s understand a bit of background on the same.
Today, developers are able to create a .js file in the visual studio editor and start sprinkling in the TypeScript code as JSDoc. Though they are just documentation, TypeScript uses them to enhance the experience of JS code editing.
However, many things have changed in the last few years as people have converged more toward a design that works well with the direction TypeScript has moved toward. This convergence that types are totally ignored and erasable syntax alongside the broad use of TypeScript made Microsoft feel more confident about this proposal.
Plus, when other teams outside of their core team reached out with the same proposal called types as comments. The idea here is that JS could carve out the syntax for types that engines would ignore but other tools like TypeScript and Flow can use. This would allow Microsoft to keep things that developers loved — types and remove the need for a build step during development.
The below image perfectly depicts what it was before and what this proposal is planning to do:
With this thing carved out, Microsoft allowed type-checkers to innovate in ways that required new syntax. However, this does not mean that engines could run codes with no type sense at all but type-checkers can be prescriptive and enforce stricter constraints than runtimes.
As important as it is to mention what this proposal does, it’s also important to state what this proposal doesn’t support. Microsoft isn’t proposing putting type-checking of TypeScript in all browsers and JS runtime.
They also don’t propose a new type-checker and put it into all browsers. Doing that would cause troubles for JS and TS both due to the issues such as runtime performance, compatibility issues with existing TS, and the risk of halting innovation in the type-checking.
If Microsoft is able to pull this proposal off perfectly, they have a chance to make one of the most impactful improvements to the world of JS. You can learn more about this proposal by going into the proposal repository on Github.