While that might sound an awful lot like TypeScript, it's different.
Microsoft's Daniel Rosenwasser, senior program manager for TypeScript, penned a comprehensive March 9 blog post explaining the proposal, which could be years in the making if it moves forward.
As the above proposal indicates, the syntax would act like comments, not affecting how surrounding code runs.
Here's a graphic showing how a developer's inner loop would look in the new scheme when it comes to writing and running code:
- type annotations on variables and functions
- (optionally) modifiers (
?) for parameters and class members
- type declarations (
- type assertion operators (
While other constructs like visibility modifiers -- for example,
protected -- might also be in scope, others like enums, namespaces and parameter properties would be out of scope because they have observable runtime behavior.
"Reaching Stage 1 would mean that the standards committee believes that supporting type syntax is worth considering for ECMAScript," Rosenwasser said. "This isn't a sure-fire thing -- there are many valuable perspectives within the committee, and we do expect some amount of skepticism. A proposal like this will receive a lot of feedback and appropriate scrutiny. It may involve lots design changes along the way, and may take years to yield results.
David Ramel is an editor and writer for Converge360.