Will JavaScript Get Native Type Annotations? Inside Microsoft’s New Proposal
Microsoft’s recent proposal to add optional type‑annotation syntax to JavaScript aims to let external tools like TypeScript perform static checks while keeping runtime behavior unchanged, sparking both excitement and debate among developers.
Microsoft and partner companies have submitted a proposal to add “type annotations” (type‑annotation declarations) to JavaScript, allowing developers to write optional type information that external type checkers can verify while the JavaScript engine ignores it at runtime.
The proposal would bring some TypeScript features directly into JavaScript, addressing long‑standing calls for language innovation.
Example of the current JSDoc style used with TypeScript:
/**
* @param a {number}
* @param b {number}
*/
function add(a, b) {
return a + b;
}If the proposal is accepted, the same function could be written with native type syntax:
function add(a: number, b: number) {
return a + b;
}Daniel Rosenwasser explains that the goal is not to embed runtime type checking into every JavaScript engine, but to provide an optional syntax that tools like TypeScript, Flow, and other static analysers can use.
While many developers who rely on type checkers welcome the idea, others worry it could add complexity or be ignored if not widely adopted.
Since the proposal’s release, the community has been divided, with both enthusiastic support and cautious criticism.
Rosenwasser notes that the proposal will generate extensive feedback and thorough review.
At present, the proposal is only at Stage 1 of the ECMA TC39 process, meaning it still faces significant hurdles before becoming part of the ECMAScript standard.
A 2021 JavaScript developer survey involving over 16,000 participants showed strong interest in type‑declaration features, suggesting a readiness for such an evolution.
For more details, see Microsoft’s official blog post: https://devblogs.microsoft.com/typescript/a-proposal-for-type-syntax-in-javascript/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
