Overview
The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project.
The tsconfig.json file specifies the root files and the compiler options required to compile the project.
A project is compiled in one of the following ways:
Using tsconfig.json
- By invoking tsc with no input files, in which case the compiler searches for the
tsconfig.jsonfile starting in the current directory and continuing up the parent directory chain. - By invoking tsc with no input files and a
--project(or just-p) command line option that specifies the path of a directory containing atsconfig.jsonfile, or a path to a valid.jsonfile containing the configurations.
When input files are specified on the command line, tsconfig.json files are ignored.
Examples
Example tsconfig.json files:
-
Using the
"files"propertyjson{ "compilerOptions": { "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": true }, "files": [ "core.ts", "sys.ts", "types.ts", "scanner.ts", "parser.ts", "utilities.ts", "binder.ts", "checker.ts", "emitter.ts", "program.ts", "commandLineParser.ts", "tsc.ts", "diagnosticInformationMap.generated.ts" ] } -
Using the
"include"and"exclude"propertiesjson{ "compilerOptions": { "module": "system", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "outFile": "../../built/local/tsc.js", "sourceMap": true }, "include": ["src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"] }
Details
The "compilerOptions" property can be omitted, in which case the compiler’s defaults are used. See our full list of supported Compiler Options.
Schema
Schema can be found at: http://json.schemastore.org/tsconfig