Update error message

This commit is contained in:
Mohamed Hegazy
2016-05-17 17:15:06 -07:00
parent 53f6755907
commit 02f0065c95
4 changed files with 8 additions and 5 deletions

View File

@@ -447,7 +447,7 @@
"category": "Error",
"code": 1147
},
"Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": {
"Cannot use 'import', 'export' or module augmentation when compiling with '--module' is 'none'.": {
"category": "Error",
"code": 1148
},

View File

@@ -2080,7 +2080,7 @@ namespace ts {
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && options.module === ModuleKind.None) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file));
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_import_export_or_module_augmentation_when_compiling_with_module_is_none));
}
// Cannot specify module gen target of es6 when below es6

View File

@@ -1,11 +1,14 @@
error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
tests/cases/compiler/file1.ts(2,1): error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is provided with a valid module type.
tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
!!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/file1.ts (0 errors) ====
==== tests/cases/compiler/file1.ts (1 errors) ====
export var x;
~~~~~~~~~~~~~
!!! error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is provided with a valid module type.
==== tests/cases/compiler/file2.ts (1 errors) ====
var y;
~~~

View File

@@ -1,10 +1,10 @@
tests/cases/compiler/a.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
tests/cases/compiler/a.ts(1,14): error TS1148: Cannot use 'import', 'export' or module augmentation when compiling with '--module' is 'none'.
==== tests/cases/compiler/a.ts (1 errors) ====
export class Foo {
~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file.
!!! error TS1148: Cannot use 'import', 'export' or module augmentation when compiling with '--module' is 'none'.
foo: string;
}