Details

Details The "compilerOptions" property can be omitted, in which case the compiler’s defaults are used. See our full list of supported Compiler Options. The "files" property takes a list of relative or absolute file paths. The "include" and "exclude" properties take a list of glob-like file patterns. The supported glob wildcards are: * matches zero or more characters (excluding directory separators) ? matches any one character (excluding directory separators) **/ recursively matches any subdi

Schema

Schema Schema can be found at: http://json.schemastore.org/tsconfig

Parameter Decorators

Parameter Decorators A Parameter Decorator is declared just before a parameter declaration. The parameter decorator is applied to the function for a class constructor or method declaration. A parameter decorator cannot be used in a declaration file, an overload, or in any other ambient context (such as in a declare class). The expression for the parameter decorator will be called as a function at runtime, with the following three arguments: Either the constructor function of the class for a sta

Attribute type checking

Attribute type checking The first step to type checking attributes is to determine the element attributes type. This is slightly different between intrinsic and value-based elements. For intrinsic elements, it is the type of the property on JSX.IntrinsicElements declare namespace JSX { interface IntrinsicElements { foo: { bar?: boolean } } } // element attributes type for 'foo' is '{bar?: boolean}' <foo bar />; For value-based elements, it is a bit more complex. It is determined b

module-plugin.d.ts

// Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~] // Project: [~THE PROJECT NAME~] // Definitions by: [~YOUR NAME~] <[~A URL FOR YOU~]> /*~ This is the module plugin template file. You should rename it to index.d.ts *~ and place it in a folder with the same name as the module. *~ For example, if you were writing a file for "super-greeter", this *~ file should be 'super-greeter/index.d.ts' */ /*~ On this line, import the module which this module adds to */ impo

Abstract Classes

Abstract Classes Abstract classes are base classes from which other classes may be derived. They may not be instantiated directly. Unlike an interface, an abstract class may contain implementation details for its members. The abstract keyword is used to define abstract classes as well as abstract methods within an abstract class. abstract class Animal { abstract makeSound(): void; move(): void { console.log("roaming the earth..."); } } Methods within an abstract class that are marked

Re-exports

Re-exports Often modules extend other modules, and partially expose some of their features. A re-export does not import it locally, or introduce a local variable. ParseIntBasedZipCodeValidator.ts export class ParseIntBasedZipCodeValidator { isAcceptable(s: string) { return s.length === 5 && parseInt(s).toString() === s; } } // Export original validator but rename it export {ZipCodeValidator as RegExpBasedZipCodeValidator} from "./ZipCodeValidator"; Optionally, a module can wra

Global Variables

Global Variables Documentation The global variable foo contains the number of widgets present. Code console.log("Half the number of widgets is " + (foo / 2)); Declaration Use declare var to declare variables. If the variable is read-only, you can use declare const. You can also use declare let if the variable is block-scoped. /** The number of widgets present */ declare var foo: number;

&lt;amd-module /&gt;

/// <amd-module /> By default AMD modules are generated anonymous. This can lead to problems when other tools are used to process the resulting modules, such as bundlers (e.g. r.js). The amd-module directive allows passing an optional module name to the compiler: amdModule.ts ///<amd-module name="NamedModule"/> export class C { } Will result in assigning the name NamedModule to the module as part of calling the AMD define: amdModule.js define("NamedModule", ["require", "exports"],

Null and Undefined

Null and Undefined In TypeScript, both undefined and null actually have their own types named undefined and null respectively. Much like void, they’re not extremely useful on their own: // Not much else we can assign to these variables! let u: undefined = undefined; let n: null = null; By default null and undefined are subtypes of all other types. That means you can assign null and undefined to something like number. However, when using the --strictNullChecks flag, null and undefined are only