tsconfig.json notes

New module output as of TypeScript 1.5 (7.20.2015) – TypeScript has supported multiple module loaders since the early days. Because JavaScript is used in both the browser and on the server, TypeScript has supported compiling modules for either AMD or CommonJS.

We’re adding two new module output formats to help continue support more JavaScript practices: SystemJS and UMD. SystemJS will allow you to use ES6 modules closer to their native semantics without requiring an ES6-compatible browser engine. UMD gives you a way to output a single module that works in both AMD and CommonJS.


Microsoft has a tsconfig.json wiki From the wiki:

  • The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project.
  • If no “files” property is present in the tsconfig.json file, the compiler defaults to including all fiels in the containing directory and sub-directories. When a “files” property is specified, only those files are included.
  • The tsconfig.json file specifies the root files and the compiler options required to compile the project. Note that if/when input files are specified on the command line, tsconfig.json files are ignored.

emitDecoratorMetadata – Setting this flag to true in tsconfig.json or on the command line) “is necessary so the javascript output creates the metadata for the decorators” according to comment in http://stackoverflow.com/questions/30311514/injectables-in-angular2


After adding

    "experimentalDecorators": true,

to my 5 Minute QuickStart app’s tsconfig.json file and seeing it work correctly, I closed the folder. The next day I reopened it in VS Code and the the transpiler ignored the experimentalDecorators key/value pair – the MyAppComponent class had a red squiggly under it.

I removed and then re-added “experimentalDecorators”: true, back to the “compilerOptions” array of key/value pairs and the transpiler seemed to see it again as the build worked after that.


From the Microsoft wiki:

  • If no “files” property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories.
  • When a “files” property is specified, only those files are included.

Advertisements

One thought on “tsconfig.json notes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s