Skip to content

Commit cec8f0d

Browse files
committed
Suggests that tsconfig.json is incorrect only when SyntaxError is caught
1 parent 803946f commit cec8f0d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Diff for: packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,16 @@ function verifyTypeScriptSetup() {
172172

173173
parsedCompilerOptions = result.options;
174174
} catch (e) {
175-
console.error(
176-
chalk.red.bold(
177-
'Could not parse',
178-
chalk.cyan('tsconfig.json') + '.',
179-
'Please make sure it contains syntactically correct JSON.'
180-
)
181-
);
175+
if (e && e.name === 'SyntaxError') {
176+
console.error(
177+
chalk.red.bold(
178+
'Could not parse',
179+
chalk.cyan('tsconfig.json') + '.',
180+
'Please make sure it contains syntactically correct JSON.'
181+
)
182+
);
183+
}
184+
182185
console.error(e && e.message ? `Details: ${e.message}` : '');
183186
process.exit(1);
184187
}

0 commit comments

Comments
 (0)