Tutorial by Examples

The presence of a tsconfig.json file indicates that the current directory is the root of a TypeScript enabled project. Initializing a TypeScript project, or better put tsconfig.json file, can be done through the following command: tsc --init As of TypeScript v2.3.0 and higher this will create t...
Setting a top-level property compileOnSave signals to the IDE to generate all files for a given tsconfig.json upon saving. { "compileOnSave": true, "compilerOptions": { ... }, "exclude": [ ... ] } This feature is available...
A tsconfig.json file can contain both line and block comments, using the same rules as ECMAScript. //Leading comment { "compilerOptions": { //this is a line comment "module": "commonjs", //eol line comment "target" /*inline bl...
There are very good configurations to force typings and get more helpful errors which are not activated by default. { "compilerOptions": { "alwaysStrict": true, // Parse in strict mode and emit "use strict" for each source file. // If you have wrong c...
Typescript supports costant enumerables, declared through const enum. This is usually just syntax sugar as the costant enums are inlined in compiled JavaScript. For instance the following code const enum Tristate { True, False, Unknown } var something = Tristate.True; compil...

Page 1 of 1