Skip to content

Commit 61dd8ca

Browse files
committed
tsconfig: Add support for comments
1 parent 2d0a28a commit 61dd8ca

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

resources/build-npm.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ fs.rmSync('./npmDist', { recursive: true, force: true });
1818
fs.mkdirSync('./npmDist');
1919

2020
// Based on https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#getting-the-dts-from-a-javascript-file
21-
const tsConfig = JSON.parse(
22-
fs.readFileSync(localRepoPath('tsconfig.json'), 'utf-8'),
21+
const tsConfigPath = localRepoPath('tsconfig.json');
22+
const { config: tsConfig, error: tsConfigError } = ts.parseConfigFileTextToJson(
23+
tsConfigPath,
24+
fs.readFileSync(tsConfigPath, 'utf-8'),
25+
);
26+
assert(
27+
tsConfigError === undefined,
28+
'Fail to parse config: ' + tsConfigError,
2329
);
2430
assert(
2531
tsConfig.compilerOptions,

tsconfig.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@
1414
"isolatedModules": true,
1515
"importsNotUsedAsValues": "error",
1616
"forceConsistentCasingInFileNames": true,
17+
18+
// Type Checking
19+
// https://www.typescriptlang.org/tsconfig#Type_Checking_6248
1720
"strict": true,
18-
"useUnknownInCatchVariables": false,
21+
"useUnknownInCatchVariables": false, // FIXME part of 'strict' but is temporary disabled
22+
// All checks that are not part of "strict"
1923
"allowUnreachableCode": false,
2024
"allowUnusedLabels": false,
21-
"exactOptionalPropertyTypes": false,
22-
"noFallthroughCasesInSwitch": false,
23-
"noImplicitOverride": false,
24-
"noImplicitReturns": false,
25-
"noPropertyAccessFromIndexSignature": false,
26-
"noUncheckedIndexedAccess": false,
25+
"exactOptionalPropertyTypes": false, // FIXME
26+
"noFallthroughCasesInSwitch": false, // TODO consider
27+
"noImplicitOverride": false, // FIXME
28+
"noImplicitReturns": false, // TODO consider
29+
"noPropertyAccessFromIndexSignature": false, // TODO consider
30+
"noUncheckedIndexedAccess": false, // FIXME
2731
"noUnusedLocals": true,
2832
"noUnusedParameters": true
2933
}

0 commit comments

Comments
 (0)