Type Script optionally provides source maps, enabling source-level debugging.
Type Script tools typically emit Java Script upon file save, preserving the test, edit, refresh cycle commonly used in Java Script development.
The following example declares the 'document' object supplied by browsers.
Because the declaration does not specify a type, the type 'any' is inferred.
For example, by default the Type Script compiler will print an error for uses of undefined variables.
To add some of the common variables defined by browsers, a Type Script programmer can use ambient declarations.
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.
Type Script does not transform variable names, making tractable the direct debugging of emitted Java Script.Every Java Script program is also a Type Script program.The Type Script compiler performs only file-local transformations on Type Script programs and does not re-order variables declared in Type Script.In this example, the programmer benefits from type inference without providing type annotations.Some beneficial tools, however, do require the programmer to provide type annotations.