Error if --checkJs is used without --allowJs

This commit is contained in:
Mohamed Hegazy
2017-03-07 13:49:52 -08:00
parent 9305d4d99e
commit fb218b7897
3 changed files with 19 additions and 0 deletions

View File

@@ -1685,6 +1685,10 @@ namespace ts {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"));
}
if (options.checkJs && !options.allowJs) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));

View File

@@ -0,0 +1,9 @@
error TS5052: Option 'checkJs' cannot be specified without specifying option 'allowJs'.
error TS6054: File 'tests/cases/compiler/a.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
!!! error TS5052: Option 'checkJs' cannot be specified without specifying option 'allowJs'.
!!! error TS6054: File 'tests/cases/compiler/a.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
==== tests/cases/compiler/a.js (0 errors) ====
var x;

View File

@@ -0,0 +1,6 @@
// @allowJs: false
// @checkJs: true
// @noEmit: true
// @fileName: a.js
var x;