JavaScript language is invited to add syntax with type information

Microsoft, Igalia and Bloomberg performed with an inclusion initiative In the JavaScript specification of the syntax for explicitly defining types similar to the syntax used in TypeScript. Currently, the prototype of the changes proposed for inclusion in the ECMAScript standard, is made for preliminary discussions (Stage 0). At the nearest March meeting of the TC39 Committee, it is planned to go to the first step of consideration of the proposal with the involvement of the expert community from ECMA.

The presence of clearly specified types of types will allow to avoid many errors in the development process, will provide an opportunity to use additional optimization techniques, simplify debugging and make the code more readable and easy to refine and support by third-party developers. Type support is proposed to implement as an optional feature – JavaScript engines and Runtime not supporting types of types will ignore annotations with types of types and process code as before, perceiving types of types as comments. But Type checking tools will be able to identify errors associated with the incorrect types of types on the basis of available information.

In addition, as opposed to information about the types specified using JSDOC annotations, specified in the form of comments, direct indication of the types directly in the design structures of variables will make the code more visual, understandable and easy to edit. For example, the Integrated TypeScript Development Environment will be able to immediately highlight errors in the JavaScript code type-based without additional transformations. In addition, the built-in support support will provide the ability to perform programs written in typenic JavaScript dialects, such as TypeScript and Flow, without Transpilation from one language to another.



From the types, it is proposed to add “String”, “Number” and “Boolean”, which can be used when determining variables, parameters of functions, elements of objects, fields of classes, typed arrays (“Number []”). It is also proposed to provide support for integrated types (“String | Number”) and generics.

/Media reports.