Skip to content

Commit 10a6137

Browse files
committed
docs: add comments for nearly all tsconfig options in use
- since we can use comments in tsconfig.json, add them to give simple, one-liner explanations as to what each setting does - also add a link to the TSConfig Reference for further details - and specify which options are recommended as true by TS but not on by default for backwards compat or other reasons - a few leftover that I still need to think about
1 parent c802b8b commit 10a6137

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

templates/basic/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
{
2+
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
23
"include": ["src", "types"],
34
"compilerOptions": {
45
"module": "esnext",
56
"lib": ["dom", "esnext"],
67
"importHelpers": true,
8+
// output .d.ts declaration files for consumers
79
"declaration": true,
10+
// output .js.map sourcemap files for consumers
811
"sourceMap": true,
12+
// match output dir to input dir. e.g. dist/index instead of dist/src/index
913
"rootDir": "./src",
14+
// stricter type-checking for stronger correctness. Recommended by TS
1015
"strict": true,
16+
// linter checks for common issues
1117
"noUnusedLocals": true,
1218
"noUnusedParameters": true,
1319
"noImplicitReturns": true,
1420
"noFallthroughCasesInSwitch": true,
21+
// use Node's module resolution algorithm, instead of the legacy TS one
1522
"moduleResolution": "node",
23+
// transpile JSX to React.createElement
1624
"jsx": "react",
25+
// interop between ESM and CJS modules. Recommended by TS
1726
"esModuleInterop": true,
27+
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
1828
"skipLibCheck": true,
29+
// error out if import and file system have a casing mismatch. Recommended by TS
1930
"forceConsistentCasingInFileNames": true,
31+
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
2032
"noEmit": true,
2133
}
2234
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
{
2+
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
23
"include": ["src", "types"],
34
"compilerOptions": {
45
"module": "esnext",
56
"lib": ["dom", "esnext"],
67
"importHelpers": true,
8+
// output .d.ts declaration files for consumers
79
"declaration": true,
10+
// output .js.map sourcemap files for consumers
811
"sourceMap": true,
12+
// match output dir to input dir. e.g. dist/index instead of dist/src/index
913
"rootDir": "./src",
14+
// stricter type-checking for stronger correctness. Recommended by TS
1015
"strict": true,
16+
// linter checks for common issues
1117
"noUnusedLocals": true,
1218
"noUnusedParameters": true,
1319
"noImplicitReturns": true,
1420
"noFallthroughCasesInSwitch": true,
21+
// use Node's module resolution algorithm, instead of the legacy TS one
1522
"moduleResolution": "node",
23+
// transpile JSX to React.createElement
1624
"jsx": "react",
25+
// interop between ESM and CJS modules. Recommended by TS
1726
"esModuleInterop": true,
27+
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
1828
"skipLibCheck": true,
29+
// error out if import and file system have a casing mismatch. Recommended by TS
1930
"forceConsistentCasingInFileNames": true,
31+
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
2032
"noEmit": true,
2133
}
2234
}

templates/react/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
{
2+
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
23
"include": ["src", "types"],
34
"compilerOptions": {
45
"module": "esnext",
56
"lib": ["dom", "esnext"],
67
"importHelpers": true,
8+
// output .d.ts declaration files for consumers
79
"declaration": true,
10+
// output .js.map sourcemap files for consumers
811
"sourceMap": true,
12+
// match output dir to input dir. e.g. dist/index instead of dist/src/index
913
"rootDir": "./src",
14+
// stricter type-checking for stronger correctness. Recommended by TS
1015
"strict": true,
16+
// linter checks for common issues
1117
"noUnusedLocals": true,
1218
"noUnusedParameters": true,
1319
"noImplicitReturns": true,
1420
"noFallthroughCasesInSwitch": true,
21+
// use Node's module resolution algorithm, instead of the legacy TS one
1522
"moduleResolution": "node",
23+
// transpile JSX to React.createElement
1624
"jsx": "react",
25+
// interop between ESM and CJS modules. Recommended by TS
1726
"esModuleInterop": true,
27+
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
1828
"skipLibCheck": true,
29+
// error out if import and file system have a casing mismatch. Recommended by TS
1930
"forceConsistentCasingInFileNames": true,
31+
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
2032
"noEmit": true,
2133
}
2234
}

0 commit comments

Comments
 (0)