mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove restriction on --target es5 and --module es6
This commit is contained in:
@@ -635,10 +635,6 @@
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile modules into 'es2015' when targeting 'ES5' or lower.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
"Decorators are not valid here.": {
|
||||
"category": "Error",
|
||||
"code": 1206
|
||||
|
||||
@@ -2099,11 +2099,6 @@ namespace ts {
|
||||
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
|
||||
}
|
||||
|
||||
// Cannot specify module gen target of es6 when below es6
|
||||
if (options.module === ModuleKind.ES6 && languageVersion < ScriptTarget.ES6) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower));
|
||||
}
|
||||
|
||||
// Cannot specify module gen that isn't amd or system with --out
|
||||
if (outFile) {
|
||||
if (options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
|
||||
|
||||
!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
==== tests/cases/compiler/es5andes6module.ts (0 errors) ====
|
||||
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/es5andes6module.ts ===
|
||||
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(es5andes6module.ts, 0, 0))
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : Symbol(A.B, Decl(es5andes6module.ts, 6, 5))
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/es5andes6module.ts ===
|
||||
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo'.
|
||||
|
||||
|
||||
!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
==== tests/cases/compiler/test.ts (1 errors) ====
|
||||
|
||||
import {foo} from './foo';
|
||||
|
||||
Reference in New Issue
Block a user