Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 40c70ac

Browse files
committed
feat: Disallow "strict": false
1 parent 3c83f95 commit 40c70ac

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/checks.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export async function checkTsconfig(dirPath: string, dt: DefinitelyTypedInfo | u
8282
case "lib":
8383
case "noImplicitAny":
8484
case "noImplicitThis":
85+
case "strict":
8586
case "strictNullChecks":
8687
case "strictFunctionTypes":
8788
case "esModuleInterop":
@@ -109,7 +110,17 @@ export async function checkTsconfig(dirPath: string, dt: DefinitelyTypedInfo | u
109110
throw new Error('Must specify "lib", usually to `"lib": ["es6"]` or `"lib": ["es6", "dom"]`.');
110111
}
111112

112-
if (!("strict" in options)) {
113+
if ("strict" in options) {
114+
if (options.strict !== true) {
115+
throw new Error('When "strict" is present, it must be set to `true`.');
116+
}
117+
118+
for (const key of ["noImplicitAny", "noImplicitThis", "strictNullChecks", "strictFunctionTypes"]) {
119+
if (key in options) {
120+
throw new TypeError(`Expected "${key}" to not be set when "strict" is \`true\`.`);
121+
}
122+
}
123+
} else {
113124
for (const key of ["noImplicitAny", "noImplicitThis", "strictNullChecks", "strictFunctionTypes"]) {
114125
if (!(key in options)) {
115126
throw new Error(`Expected \`"${key}": true\` or \`"${key}": false\`.`);

0 commit comments

Comments
 (0)