Skip to content

Commit 5e0c71e

Browse files
author
Andy
authored
The global "JSON" object should always exist (#19583)
1 parent f26ac9f commit 5e0c71e

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/compiler/tsc.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,12 @@ namespace ts {
4343
return s;
4444
}
4545

46-
function isJSONSupported() {
47-
return typeof JSON === "object" && typeof JSON.parse === "function";
48-
}
49-
5046
export function executeCommandLine(args: string[]): void {
5147
const commandLine = parseCommandLine(args);
5248

5349
// Configuration file name (if any)
5450
let configFileName: string;
5551
if (commandLine.options.locale) {
56-
if (!isJSONSupported()) {
57-
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"));
58-
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
59-
}
6052
validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors);
6153
}
6254

@@ -84,10 +76,6 @@ namespace ts {
8476
}
8577

8678
if (commandLine.options.project) {
87-
if (!isJSONSupported()) {
88-
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"));
89-
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
90-
}
9179
if (commandLine.fileNames.length !== 0) {
9280
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
9381
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
@@ -109,7 +97,7 @@ namespace ts {
10997
}
11098
}
11199
}
112-
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
100+
else if (commandLine.fileNames.length === 0) {
113101
const searchPath = normalizePath(sys.getCurrentDirectory());
114102
configFileName = findConfigFile(searchPath, sys.fileExists);
115103
}

0 commit comments

Comments
 (0)