Skip to content

Commit 0b1fff7

Browse files
committed
Add --checkJsFiles
1 parent f7242f3 commit 0b1fff7

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/compiler/commandLineParser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,12 @@ namespace ts {
481481
name: "plugin",
482482
type: "object"
483483
}
484+
},
485+
{
486+
name: "checkJsFiles",
487+
type: "boolean",
488+
experimental: true,
489+
description: Diagnostics.Report_errors_in_js_files
484490
}
485491
];
486492

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,5 +3362,9 @@
33623362
"Octal literals are not allowed in enums members initializer. Use the syntax '{0}'.": {
33633363
"category": "Error",
33643364
"code": 8018
3365+
},
3366+
"Report errors in .js files.": {
3367+
"category": "Message",
3368+
"code": 8019
33653369
}
33663370
}

src/compiler/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ namespace ts {
907907
// For JavaScript files, we don't want to report semantic errors.
908908
// Instead, we'll report errors for using TypeScript-only constructs from within a
909909
// JavaScript file when we get syntactic diagnostics for the file.
910-
const checkDiagnostics = isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);
910+
const checkDiagnostics = !options.checkJsFiles && isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken);
911911
const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
912912
const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
913913

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,6 +3312,7 @@
33123312
alwaysStrict?: boolean; // Always combine with strict property
33133313
baseUrl?: string;
33143314
charset?: string;
3315+
checkJsFiles?: boolean;
33153316
/* @internal */ configFilePath?: string;
33163317
declaration?: boolean;
33173318
declarationDir?: string;

0 commit comments

Comments
 (0)