Skip to content

Commit 72b640f

Browse files
author
Orta Therox
authored
Merge pull request #862 from microsoft/tsconfig_bases
Reference the TSConfig bases in the tsconfig docs
2 parents b0335ef + 4ff643c commit 72b640f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/documentation/copy/en/project-config/tsconfig.json.md

+29
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,35 @@ Example `tsconfig.json` files:
7171
}
7272
```
7373

74+
## TSConfig Bases
75+
76+
Depending on the JavaScript runtime environment which you intend to run your code in, there may be a base configuration which you can use at [github.com/tsconfig/bases](https://github.com/tsconfig/bases/).
77+
These are `tsconfig.json` files which your project extends from which simplifies your `tsconfig.json` by handling the runtime support.
78+
79+
For example, if you were writing a project which uses Node.js version 12 and above, then you could use the npm module [`@tsconfig/node12`](https://www.npmjs.com/package/@tsconfig/node12)
80+
81+
```json
82+
{
83+
"extends": "@tsconfig/node12/tsconfig.json",
84+
85+
"compilerOptions": {
86+
"preserveConstEnums": true
87+
},
88+
89+
"include": ["src/**/*"],
90+
"exclude": ["node_modules", "**/*.spec.ts"]
91+
}
92+
```
93+
94+
This lets your `tsconfig.json` focus on the unique choices for your project, and not all of the runtime mechanics. There are a few tsconfig bases already, and we're hoping the community can add more for different environments.
95+
96+
- [Recommended](https://www.npmjs.com/package/@tsconfig/recommended)
97+
- [Node 10](https://www.npmjs.com/package/@tsconfig/node10)
98+
- [Node 12](https://www.npmjs.com/package/@tsconfig/node12)
99+
- [Deno](https://www.npmjs.com/package/@tsconfig/deno)
100+
- [React Native](https://www.npmjs.com/package/@tsconfig/react-native)
101+
- [Svelte](https://www.npmjs.com/package/@tsconfig/svelte)
102+
74103
## Details
75104

76105
The `"compilerOptions"` property can be omitted, in which case the compiler's defaults are used. See our full list of supported [Compiler Options](/tsconfig).

0 commit comments

Comments
 (0)