Javascript validating empty fields

19 Apr

Type Script's optional type system enables Java Script programmers to use highly-productive development tools and practices: static checking, symbol-based navigation, statement completion, and code re-factoring. Type Script syntax is a superset of ECMAScript 2015 (ES2015) syntax.

The following example declares the 'document' object supplied by browsers.

Because the declaration does not specify a type, the type 'any' is inferred.

This leads to Java Script output that closely matches the Type Script input.

Type Script does not transform variable names, making tractable the direct debugging of emitted Java Script.

Within the body of function 'f', tools can assume 's' is of type 'string' and provide operator type checking and member completion consistent with this assumption.

Tools can also signal an error on the first call to 'f', because 'f' expects a string, not an object, as its parameter.

To benefit from this inference, a programmer can use the Type Script language service.