Merge pull request #4811 from weswigham/es6-module-type

Support modules when targeting ES6 and an ES6 ModuleKind
This commit is contained in:
Wesley Wigham
2015-09-24 12:09:58 -07:00
63 changed files with 999 additions and 384 deletions

View File

@@ -44,6 +44,7 @@ namespace ts {
let compilerOptions = host.getCompilerOptions();
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
let modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None;
let emitResolver = createResolver();
@@ -13379,9 +13380,9 @@ namespace ts {
}
}
else {
if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) {
if (modulekind === ModuleKind.ES6 && !isInAmbientContext(node)) {
// Import equals declaration is deprecated in es6 or above
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
}
@@ -13456,11 +13457,11 @@ namespace ts {
checkExternalModuleExports(<SourceFile | ModuleDeclaration>container);
if (node.isExportEquals && !isInAmbientContext(node)) {
if (languageVersion >= ScriptTarget.ES6) {
// export assignment is deprecated in es6 or above
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
if (modulekind === ModuleKind.ES6) {
// export assignment is not supported in es6 modules
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead);
}
else if (compilerOptions.module === ModuleKind.System) {
else if (modulekind === ModuleKind.System) {
// system modules does not support export assignment
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
}

View File

@@ -76,10 +76,11 @@ namespace ts {
"amd": ModuleKind.AMD,
"system": ModuleKind.System,
"umd": ModuleKind.UMD,
"es6": ModuleKind.ES6,
},
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd,
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6,
paramType: Diagnostics.KIND,
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6
},
{
name: "newLine",

View File

@@ -619,15 +619,15 @@
"category": "Error",
"code": 1200
},
"Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead.": {
"Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": {
"category": "Error",
"code": 1202
},
"Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.": {
"Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.": {
"category": "Error",
"code": 1203
},
"Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": {
"Cannot compile modules into 'es6' when targeting 'ES5' or lower.": {
"category": "Error",
"code": 1204
},
@@ -2101,7 +2101,7 @@
"category": "Message",
"code": 6015
},
"Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'": {
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'": {
"category": "Message",
"code": 6016
},
@@ -2185,7 +2185,7 @@
"category": "Error",
"code": 6045
},
"Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'.": {
"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'.": {
"category": "Error",
"code": 6046
},

View File

@@ -64,6 +64,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let compilerOptions = host.getCompilerOptions();
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
let modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None;
let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;
let diagnostics: Diagnostic[] = [];
let newLine = host.getNewLine();
@@ -188,6 +189,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
/** If removeComments is true, no leading-comments needed to be emitted **/
let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker;
let moduleEmitDelegates: Map<(node: SourceFile, startIndex: number) => void> = {
[ModuleKind.ES6]: emitES6Module,
[ModuleKind.AMD]: emitAMDModule,
[ModuleKind.System]: emitSystemModule,
[ModuleKind.UMD]: emitUMDModule,
[ModuleKind.CommonJS]: emitCommonJSModule,
};
if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) {
initializeEmitterWithSourceMaps();
@@ -1493,7 +1502,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (container) {
if (container.kind === SyntaxKind.SourceFile) {
// Identifier references module export
if (languageVersion < ScriptTarget.ES6 && compilerOptions.module !== ModuleKind.System) {
if (modulekind !== ModuleKind.ES6 && modulekind !== ModuleKind.System) {
write("exports.");
}
}
@@ -1503,7 +1512,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(".");
}
}
else if (languageVersion < ScriptTarget.ES6) {
else if (modulekind !== ModuleKind.ES6) {
let declaration = resolver.getReferencedImportDeclaration(node);
if (declaration) {
if (declaration.kind === SyntaxKind.ImportClause) {
@@ -3056,7 +3065,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(getGeneratedNameForNode(container));
write(".");
}
else if (languageVersion < ScriptTarget.ES6 && compilerOptions.module !== ModuleKind.System) {
else if (modulekind !== ModuleKind.ES6 && modulekind !== ModuleKind.System) {
write("exports.");
}
}
@@ -3076,7 +3085,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (node.parent.kind === SyntaxKind.SourceFile) {
Debug.assert(!!(node.flags & NodeFlags.Default) || node.kind === SyntaxKind.ExportAssignment);
// only allow export default at a source file level
if (compilerOptions.module === ModuleKind.CommonJS || compilerOptions.module === ModuleKind.AMD || compilerOptions.module === ModuleKind.UMD) {
if (modulekind === ModuleKind.CommonJS || modulekind === ModuleKind.AMD || modulekind === ModuleKind.UMD) {
if (!currentSourceFile.symbol.exports["___esModule"]) {
if (languageVersion === ScriptTarget.ES5) {
// default value of configurable, enumerable, writable are `false`.
@@ -3098,7 +3107,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitStart(node);
// emit call to exporter only for top level nodes
if (compilerOptions.module === ModuleKind.System && node.parent === currentSourceFile) {
if (modulekind === ModuleKind.System && node.parent === currentSourceFile) {
// emit export default <smth> as
// export("default", <smth>)
write(`${exportFunctionForFile}("`);
@@ -3134,7 +3143,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitExportMemberAssignments(name: Identifier) {
if (compilerOptions.module === ModuleKind.System) {
if (modulekind === ModuleKind.System) {
return;
}
@@ -3154,7 +3163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
Debug.assert(compilerOptions.module === ModuleKind.System);
Debug.assert(modulekind === ModuleKind.System);
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) {
return;
@@ -3491,7 +3500,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function isES6ExportedDeclaration(node: Node) {
return !!(node.flags & NodeFlags.Export) &&
languageVersion >= ScriptTarget.ES6 &&
modulekind === ModuleKind.ES6 &&
node.parent.kind === SyntaxKind.SourceFile;
}
@@ -5257,7 +5266,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(";");
}
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
if (compilerOptions.module === ModuleKind.System && (node.flags & NodeFlags.Export)) {
if (modulekind === ModuleKind.System && (node.flags & NodeFlags.Export)) {
// write the call to exporter for enum
writeLine();
write(`${exportFunctionForFile}("`);
@@ -5379,7 +5388,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(" = {}));");
emitEnd(node);
if (!isES6ExportedDeclaration(node) && node.name.kind === SyntaxKind.Identifier && node.parent === currentSourceFile) {
if (compilerOptions.module === ModuleKind.System && (node.flags & NodeFlags.Export)) {
if (modulekind === ModuleKind.System && (node.flags & NodeFlags.Export)) {
writeLine();
write(`${exportFunctionForFile}("`);
emitDeclarationName(node);
@@ -5443,7 +5452,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitImportDeclaration(node: ImportDeclaration) {
if (languageVersion < ScriptTarget.ES6) {
if (modulekind !== ModuleKind.ES6) {
return emitExternalImportDeclaration(node);
}
@@ -5494,7 +5503,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let isExportedImport = node.kind === SyntaxKind.ImportEqualsDeclaration && (node.flags & NodeFlags.Export) !== 0;
let namespaceDeclaration = getNamespaceDeclarationNode(node);
if (compilerOptions.module !== ModuleKind.AMD) {
if (modulekind !== ModuleKind.AMD) {
emitLeadingComments(node);
emitStart(node);
if (namespaceDeclaration && !isDefaultImport(node)) {
@@ -5606,15 +5615,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitExportDeclaration(node: ExportDeclaration) {
Debug.assert(compilerOptions.module !== ModuleKind.System);
Debug.assert(modulekind !== ModuleKind.System);
if (languageVersion < ScriptTarget.ES6) {
if (modulekind !== ModuleKind.ES6) {
if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) {
emitStart(node);
let generatedName = getGeneratedNameForNode(node);
if (node.exportClause) {
// export { x, y, ... } from "foo"
if (compilerOptions.module !== ModuleKind.AMD) {
if (modulekind !== ModuleKind.AMD) {
write("var ");
write(generatedName);
write(" = ");
@@ -5641,7 +5650,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// export * from "foo"
writeLine();
write("__export(");
if (compilerOptions.module !== ModuleKind.AMD) {
if (modulekind !== ModuleKind.AMD) {
emitRequire(getExternalModuleName(node));
}
else {
@@ -5674,7 +5683,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function emitExportOrImportSpecifierList(specifiers: ImportOrExportSpecifier[], shouldEmit: (node: Node) => boolean) {
Debug.assert(languageVersion >= ScriptTarget.ES6);
Debug.assert(modulekind === ModuleKind.ES6);
let needsComma = false;
for (let specifier of specifiers) {
@@ -5694,7 +5703,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitExportAssignment(node: ExportAssignment) {
if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) {
if (languageVersion >= ScriptTarget.ES6) {
if (modulekind === ModuleKind.ES6) {
writeLine();
emitStart(node);
write("export default ");
@@ -5709,7 +5718,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
else {
writeLine();
emitStart(node);
if (compilerOptions.module === ModuleKind.System) {
if (modulekind === ModuleKind.System) {
write(`${exportFunctionForFile}("default",`);
emit(node.expression);
write(")");
@@ -6155,7 +6164,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
function isCurrentFileSystemExternalModule() {
return compilerOptions.module === ModuleKind.System && isExternalModule(currentSourceFile);
return modulekind === ModuleKind.System && isExternalModule(currentSourceFile);
}
function emitSystemModuleBody(node: SourceFile, dependencyGroups: DependencyGroup[], startIndex: number): void {
@@ -6713,21 +6722,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
if (isExternalModule(node) || compilerOptions.isolatedModules) {
if (languageVersion >= ScriptTarget.ES6) {
emitES6Module(node, startIndex);
}
else if (compilerOptions.module === ModuleKind.AMD) {
emitAMDModule(node, startIndex);
}
else if (compilerOptions.module === ModuleKind.System) {
emitSystemModule(node, startIndex);
}
else if (compilerOptions.module === ModuleKind.UMD) {
emitUMDModule(node, startIndex);
}
else {
emitCommonJSModule(node, startIndex);
}
let emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ModuleKind.CommonJS];
emitModule(node, startIndex);
}
else {
externalImports = undefined;

View File

@@ -1022,9 +1022,9 @@ namespace ts {
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
}
// Cannot specify module gen target when in es6 or above
if (options.module && languageVersion >= ScriptTarget.ES6) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
// 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_es6_when_targeting_ES5_or_lower));
}
// there has to be common source directory if user specified --outdir || --sourceRoot

View File

@@ -2076,6 +2076,7 @@ namespace ts {
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
}
export const enum JsxEmit {

View File

@@ -1,5 +1,3 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
tests/cases/compiler/constDeclarations_access_2.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations_access_2.ts(6,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
@@ -20,12 +18,9 @@ tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The oper
tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/constDeclarations_access_2.ts (19 errors) ====
==== tests/cases/compiler/constDeclarations_access_2.ts (18 errors) ====
///<reference path='constDeclarations_access_1.ts'/>
import m = require('constDeclarations_access_1');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
// Errors
m.x = 1;
~~~

View File

@@ -49,35 +49,39 @@ m.x.toString();
//// [constDeclarations_access_1.js]
export const x = 0;
define(["require", "exports"], function (require, exports) {
exports.x = 0;
});
//// [constDeclarations_access_2.js]
// Errors
m.x = 1;
m.x += 2;
m.x -= 3;
m.x *= 4;
m.x /= 5;
m.x %= 6;
m.x <<= 7;
m.x >>= 8;
m.x >>>= 9;
m.x &= 10;
m.x |= 11;
m.x ^= 12;
m;
m.x++;
m.x--;
++m.x;
--m.x;
++((m.x));
m["x"] = 0;
// OK
var a = m.x + 1;
function f(v) { }
f(m.x);
if (m.x) { }
m.x;
(m.x);
-m.x;
+m.x;
m.x.toString();
define(["require", "exports", 'constDeclarations_access_1'], function (require, exports, m) {
// Errors
m.x = 1;
m.x += 2;
m.x -= 3;
m.x *= 4;
m.x /= 5;
m.x %= 6;
m.x <<= 7;
m.x >>= 8;
m.x >>>= 9;
m.x &= 10;
m.x |= 11;
m.x ^= 12;
m;
m.x++;
m.x--;
++m.x;
--m.x;
++((m.x));
m["x"] = 0;
// OK
var a = m.x + 1;
function f(v) { }
f(m.x);
if (m.x) { }
m.x;
(m.x);
-m.x;
+m.x;
m.x.toString();
});

View File

@@ -0,0 +1,19 @@
error TS1204: Cannot compile modules into 'es6' when targeting 'ES5' or lower.
!!! error TS1204: Cannot compile modules into 'es6' when targeting 'ES5' or lower.
==== tests/cases/compiler/es5andes6module.ts (0 errors) ====
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,26 @@
//// [es5andes6module.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es5andes6module.js]
var A = (function () {
function A() {
}
A.prototype.B = function () {
return 42;
};
return A;
})();
exports.default = A;

View File

@@ -1,18 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-amd.ts (0 errors) ====
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6-amd.ts ===
class A
>A : Symbol(A, Decl(es6-amd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6-amd.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6-amd.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,18 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-declaration-amd.ts (0 errors) ====
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6-declaration-amd.ts ===
class A
>A : Symbol(A, Decl(es6-declaration-amd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6-declaration-amd.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6-declaration-amd.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,18 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-sourcemap-amd.ts (0 errors) ====
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6-sourcemap-amd.ts ===
class A
>A : Symbol(A, Decl(es6-sourcemap-amd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6-sourcemap-amd.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6-sourcemap-amd.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,18 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd.ts (0 errors) ====
class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6-umd.ts ===
class A
>A : Symbol(A, Decl(es6-umd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6-umd.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6-umd.ts ===
class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,18 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd2.ts (0 errors) ====
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -14,10 +14,20 @@ export class A
}
//// [es6-umd2.js]
export class A {
constructor() {
(function (deps, factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
B() {
return 42;
else if (typeof define === 'function' && define.amd) {
define(deps, factory);
}
}
})(["require", "exports"], function (require, exports) {
class A {
constructor() {
}
B() {
return 42;
}
}
exports.A = A;
});

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6-umd2.ts ===
export class A
>A : Symbol(A, Decl(es6-umd2.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6-umd2.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6-umd2.ts ===
export class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,4 +1,4 @@
tests/cases/compiler/es6ExportAssignment.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/es6ExportAssignment.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
==== tests/cases/compiler/es6ExportAssignment.ts (1 errors) ====
@@ -6,4 +6,4 @@ tests/cases/compiler/es6ExportAssignment.ts(3,1): error TS1203: Export assignmen
var a = 10;
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.

View File

@@ -1,4 +1,4 @@
tests/cases/compiler/a.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/a.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
==== tests/cases/compiler/a.ts (1 errors) ====
@@ -6,7 +6,7 @@ tests/cases/compiler/a.ts(3,1): error TS1203: Export assignment cannot be used w
var a = 10;
export = a; // Error: export = not allowed in ES6
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
==== tests/cases/compiler/b.ts (0 errors) ====
import * as a from "a";

View File

@@ -1,4 +1,4 @@
tests/cases/compiler/es6ExportEquals.ts(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/es6ExportEquals.ts(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
tests/cases/compiler/es6ExportEquals.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -8,7 +8,7 @@ tests/cases/compiler/es6ExportEquals.ts(4,1): error TS2309: An export assignment
export = f;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.

View File

@@ -1,25 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ====
export var a = 10;
export var x = a;
export var m = a;
export default {};
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (0 errors) ====
import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = a;
import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = b;
import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = x;
var x1: number = y;
import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = z;
import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1: number = m;

View File

@@ -23,22 +23,22 @@ var x1: number = m;
//// [es6ImportDefaultBindingFollowedWithNamedImport_0.js]
export var a = 10;
export var x = a;
export var m = a;
export default {};
exports.a = 10;
exports.x = exports.a;
exports.m = exports.a;
exports.default = {};
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
import { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = a;
import { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = b;
import { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = x;
var x1 = y;
import { x as z } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = z;
import { m } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
var x1 = m;
var es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_1.a;
var es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_2.a;
var es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.x;
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.a;
var es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_4.x;
var es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0");
var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_5.m;
//// [es6ImportDefaultBindingFollowedWithNamedImport_0.d.ts]

View File

@@ -0,0 +1,67 @@
=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts ===
export var a = 10;
>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10))
export var x = a;
>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 2, 10))
>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10))
export var m = a;
>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 3, 10))
>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10))
export default {};
=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts ===
import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding1 : Symbol(defaultBinding1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 0, 6))
import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding2 : Symbol(defaultBinding2, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 6))
>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 25))
var x1: number = a;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 25))
import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding3 : Symbol(defaultBinding3, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 6))
>a : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25))
>b : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25))
var x1: number = b;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>b : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25))
import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding4 : Symbol(defaultBinding4, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 6))
>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 25))
>a : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28))
>y : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28))
var x1: number = x;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 25))
var x1: number = y;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>y : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28))
import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding5 : Symbol(defaultBinding5, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 6))
>x : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25))
>z : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25))
var x1: number = z;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>z : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25))
import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding6 : Symbol(defaultBinding6, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 6))
>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 25))
var x1: number = m;
>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3))
>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 25))

View File

@@ -0,0 +1,69 @@
=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts ===
export var a = 10;
>a : number
>10 : number
export var x = a;
>x : number
>a : number
export var m = a;
>m : number
>a : number
export default {};
>{} : {}
=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts ===
import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding1 : {}
import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding2 : {}
>a : number
var x1: number = a;
>x1 : number
>a : number
import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding3 : {}
>a : number
>b : number
var x1: number = b;
>x1 : number
>b : number
import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding4 : {}
>x : number
>a : number
>y : number
var x1: number = x;
>x1 : number
>x : number
var x1: number = y;
>x1 : number
>y : number
import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding5 : {}
>x : number
>z : number
var x1: number = z;
>x1 : number
>z : number
import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0";
>defaultBinding6 : {}
>m : number
var x1: number = m;
>x1 : number
>m : number

View File

@@ -1,15 +1,15 @@
tests/cases/compiler/client.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
tests/cases/compiler/server.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
tests/cases/compiler/client.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
tests/cases/compiler/server.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
==== tests/cases/compiler/client.ts (1 errors) ====
import a = require("server");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
==== tests/cases/compiler/server.ts (1 errors) ====
var a = 10;
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.

View File

@@ -1,13 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNameSpaceImport_0.ts (0 errors) ====
export var a = 10;
==== tests/cases/compiler/es6ImportNameSpaceImport_1.ts (0 errors) ====
import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0";
var x = nameSpaceBinding.a;
import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this

View File

@@ -11,9 +11,9 @@ import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this
//// [es6ImportNameSpaceImport_0.js]
export var a = 10;
exports.a = 10;
//// [es6ImportNameSpaceImport_1.js]
import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0";
var nameSpaceBinding = require("./es6ImportNameSpaceImport_0");
var x = nameSpaceBinding.a;

View File

@@ -0,0 +1,18 @@
=== tests/cases/compiler/es6ImportNameSpaceImport_0.ts ===
export var a = 10;
>a : Symbol(a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10))
=== tests/cases/compiler/es6ImportNameSpaceImport_1.ts ===
import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0";
>nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImport_1.ts, 0, 6))
var x = nameSpaceBinding.a;
>x : Symbol(x, Decl(es6ImportNameSpaceImport_1.ts, 1, 3))
>nameSpaceBinding.a : Symbol(nameSpaceBinding.a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10))
>nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImport_1.ts, 0, 6))
>a : Symbol(nameSpaceBinding.a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10))
import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this
>nameSpaceBinding2 : Symbol(nameSpaceBinding2, Decl(es6ImportNameSpaceImport_1.ts, 2, 6))

View File

@@ -0,0 +1,19 @@
=== tests/cases/compiler/es6ImportNameSpaceImport_0.ts ===
export var a = 10;
>a : number
>10 : number
=== tests/cases/compiler/es6ImportNameSpaceImport_1.ts ===
import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0";
>nameSpaceBinding : typeof nameSpaceBinding
var x = nameSpaceBinding.a;
>x : number
>nameSpaceBinding.a : number
>nameSpaceBinding : typeof nameSpaceBinding
>a : number
import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this
>nameSpaceBinding2 : typeof nameSpaceBinding

View File

@@ -1,44 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNamedImport_0.ts (0 errors) ====
export var a = 10;
export var x = a;
export var m = a;
export var a1 = 10;
export var x1 = 10;
export var z1 = 10;
export var z2 = 10;
export var aaaa = 10;
==== tests/cases/compiler/es6ImportNamedImport_1.ts (0 errors) ====
import { } from "./es6ImportNamedImport_0";
import { a } from "./es6ImportNamedImport_0";
var xxxx = a;
import { a as b } from "./es6ImportNamedImport_0";
var xxxx = b;
import { x, a as y } from "./es6ImportNamedImport_0";
var xxxx = x;
var xxxx = y;
import { x as z, } from "./es6ImportNamedImport_0";
var xxxx = z;
import { m, } from "./es6ImportNamedImport_0";
var xxxx = m;
import { a1, x1 } from "./es6ImportNamedImport_0";
var xxxx = a1;
var xxxx = x1;
import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0";
var xxxx = a11;
var xxxx = x11;
import { z1 } from "./es6ImportNamedImport_0";
var z111 = z1;
import { z2 as z3 } from "./es6ImportNamedImport_0";
var z2 = z3; // z2 shouldn't give redeclare error
// These are elided
import { aaaa } from "./es6ImportNamedImport_0";
// These are elided
import { aaaa as bbbb } from "./es6ImportNamedImport_0";

View File

@@ -42,36 +42,36 @@ import { aaaa as bbbb } from "./es6ImportNamedImport_0";
//// [es6ImportNamedImport_0.js]
export var a = 10;
export var x = a;
export var m = a;
export var a1 = 10;
export var x1 = 10;
export var z1 = 10;
export var z2 = 10;
export var aaaa = 10;
exports.a = 10;
exports.x = exports.a;
exports.m = exports.a;
exports.a1 = 10;
exports.x1 = 10;
exports.z1 = 10;
exports.z2 = 10;
exports.aaaa = 10;
//// [es6ImportNamedImport_1.js]
import { a } from "./es6ImportNamedImport_0";
var xxxx = a;
import { a as b } from "./es6ImportNamedImport_0";
var xxxx = b;
import { x, a as y } from "./es6ImportNamedImport_0";
var xxxx = x;
var xxxx = y;
import { x as z } from "./es6ImportNamedImport_0";
var xxxx = z;
import { m } from "./es6ImportNamedImport_0";
var xxxx = m;
import { a1, x1 } from "./es6ImportNamedImport_0";
var xxxx = a1;
var xxxx = x1;
import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0";
var xxxx = a11;
var xxxx = x11;
import { z1 } from "./es6ImportNamedImport_0";
var z111 = z1;
import { z2 as z3 } from "./es6ImportNamedImport_0";
var z2 = z3; // z2 shouldn't give redeclare error
var es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_1.a;
var es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_2.a;
var es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_3.x;
var xxxx = es6ImportNamedImport_0_3.a;
var es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_4.x;
var es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_5.m;
var es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_6.a1;
var xxxx = es6ImportNamedImport_0_6.x1;
var es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");
var xxxx = es6ImportNamedImport_0_7.a1;
var xxxx = es6ImportNamedImport_0_7.x1;
var es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");
var z111 = es6ImportNamedImport_0_8.z1;
var es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");
var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error
//// [es6ImportNamedImport_0.d.ts]

View File

@@ -0,0 +1,123 @@
=== tests/cases/compiler/es6ImportNamedImport_0.ts ===
export var a = 10;
>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10))
export var x = a;
>x : Symbol(x, Decl(es6ImportNamedImport_0.ts, 2, 10))
>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10))
export var m = a;
>m : Symbol(m, Decl(es6ImportNamedImport_0.ts, 3, 10))
>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10))
export var a1 = 10;
>a1 : Symbol(a1, Decl(es6ImportNamedImport_0.ts, 4, 10))
export var x1 = 10;
>x1 : Symbol(x1, Decl(es6ImportNamedImport_0.ts, 5, 10))
export var z1 = 10;
>z1 : Symbol(z1, Decl(es6ImportNamedImport_0.ts, 6, 10))
export var z2 = 10;
>z2 : Symbol(z2, Decl(es6ImportNamedImport_0.ts, 7, 10))
export var aaaa = 10;
>aaaa : Symbol(aaaa, Decl(es6ImportNamedImport_0.ts, 8, 10))
=== tests/cases/compiler/es6ImportNamedImport_1.ts ===
import { } from "./es6ImportNamedImport_0";
import { a } from "./es6ImportNamedImport_0";
>a : Symbol(a, Decl(es6ImportNamedImport_1.ts, 1, 8))
var xxxx = a;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>a : Symbol(a, Decl(es6ImportNamedImport_1.ts, 1, 8))
import { a as b } from "./es6ImportNamedImport_0";
>a : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8))
>b : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8))
var xxxx = b;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>b : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8))
import { x, a as y } from "./es6ImportNamedImport_0";
>x : Symbol(x, Decl(es6ImportNamedImport_1.ts, 5, 8))
>a : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11))
>y : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11))
var xxxx = x;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>x : Symbol(x, Decl(es6ImportNamedImport_1.ts, 5, 8))
var xxxx = y;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>y : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11))
import { x as z, } from "./es6ImportNamedImport_0";
>x : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8))
>z : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8))
var xxxx = z;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>z : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8))
import { m, } from "./es6ImportNamedImport_0";
>m : Symbol(m, Decl(es6ImportNamedImport_1.ts, 10, 8))
var xxxx = m;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>m : Symbol(m, Decl(es6ImportNamedImport_1.ts, 10, 8))
import { a1, x1 } from "./es6ImportNamedImport_0";
>a1 : Symbol(a1, Decl(es6ImportNamedImport_1.ts, 12, 8))
>x1 : Symbol(x1, Decl(es6ImportNamedImport_1.ts, 12, 12))
var xxxx = a1;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>a1 : Symbol(a1, Decl(es6ImportNamedImport_1.ts, 12, 8))
var xxxx = x1;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>x1 : Symbol(x1, Decl(es6ImportNamedImport_1.ts, 12, 12))
import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0";
>a1 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8))
>a11 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8))
>x1 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19))
>x11 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19))
var xxxx = a11;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>a11 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8))
var xxxx = x11;
>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3))
>x11 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19))
import { z1 } from "./es6ImportNamedImport_0";
>z1 : Symbol(z1, Decl(es6ImportNamedImport_1.ts, 18, 8))
var z111 = z1;
>z111 : Symbol(z111, Decl(es6ImportNamedImport_1.ts, 19, 3))
>z1 : Symbol(z1, Decl(es6ImportNamedImport_1.ts, 18, 8))
import { z2 as z3 } from "./es6ImportNamedImport_0";
>z2 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8))
>z3 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8))
var z2 = z3; // z2 shouldn't give redeclare error
>z2 : Symbol(z2, Decl(es6ImportNamedImport_1.ts, 21, 3))
>z3 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8))
// These are elided
import { aaaa } from "./es6ImportNamedImport_0";
>aaaa : Symbol(aaaa, Decl(es6ImportNamedImport_1.ts, 24, 8))
// These are elided
import { aaaa as bbbb } from "./es6ImportNamedImport_0";
>aaaa : Symbol(bbbb, Decl(es6ImportNamedImport_1.ts, 26, 8))
>bbbb : Symbol(bbbb, Decl(es6ImportNamedImport_1.ts, 26, 8))

View File

@@ -0,0 +1,129 @@
=== tests/cases/compiler/es6ImportNamedImport_0.ts ===
export var a = 10;
>a : number
>10 : number
export var x = a;
>x : number
>a : number
export var m = a;
>m : number
>a : number
export var a1 = 10;
>a1 : number
>10 : number
export var x1 = 10;
>x1 : number
>10 : number
export var z1 = 10;
>z1 : number
>10 : number
export var z2 = 10;
>z2 : number
>10 : number
export var aaaa = 10;
>aaaa : number
>10 : number
=== tests/cases/compiler/es6ImportNamedImport_1.ts ===
import { } from "./es6ImportNamedImport_0";
import { a } from "./es6ImportNamedImport_0";
>a : number
var xxxx = a;
>xxxx : number
>a : number
import { a as b } from "./es6ImportNamedImport_0";
>a : number
>b : number
var xxxx = b;
>xxxx : number
>b : number
import { x, a as y } from "./es6ImportNamedImport_0";
>x : number
>a : number
>y : number
var xxxx = x;
>xxxx : number
>x : number
var xxxx = y;
>xxxx : number
>y : number
import { x as z, } from "./es6ImportNamedImport_0";
>x : number
>z : number
var xxxx = z;
>xxxx : number
>z : number
import { m, } from "./es6ImportNamedImport_0";
>m : number
var xxxx = m;
>xxxx : number
>m : number
import { a1, x1 } from "./es6ImportNamedImport_0";
>a1 : number
>x1 : number
var xxxx = a1;
>xxxx : number
>a1 : number
var xxxx = x1;
>xxxx : number
>x1 : number
import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0";
>a1 : number
>a11 : number
>x1 : number
>x11 : number
var xxxx = a11;
>xxxx : number
>a11 : number
var xxxx = x11;
>xxxx : number
>x11 : number
import { z1 } from "./es6ImportNamedImport_0";
>z1 : number
var z111 = z1;
>z111 : number
>z1 : number
import { z2 as z3 } from "./es6ImportNamedImport_0";
>z2 : number
>z3 : number
var z2 = z3; // z2 shouldn't give redeclare error
>z2 : number
>z3 : number
// These are elided
import { aaaa } from "./es6ImportNamedImport_0";
>aaaa : number
// These are elided
import { aaaa as bbbb } from "./es6ImportNamedImport_0";
>aaaa : number
>bbbb : number

View File

@@ -1,14 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts (0 errors) ====
export var a = 10;
==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts (1 errors) ====
import { a } from "./es6ImportNamedImportInExportAssignment_0";
export = a;
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.

View File

@@ -9,9 +9,10 @@ import { a } from "./es6ImportNamedImportInExportAssignment_0";
export = a;
//// [es6ImportNamedImportInExportAssignment_0.js]
export var a = 10;
exports.a = 10;
//// [es6ImportNamedImportInExportAssignment_1.js]
import { a } from "./es6ImportNamedImportInExportAssignment_0";
var es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0");
module.exports = es6ImportNamedImportInExportAssignment_0_1.a;
//// [es6ImportNamedImportInExportAssignment_0.d.ts]

View File

@@ -0,0 +1,12 @@
=== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts ===
export var a = 10;
>a : Symbol(a, Decl(es6ImportNamedImportInExportAssignment_0.ts, 1, 10))
=== tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts ===
import { a } from "./es6ImportNamedImportInExportAssignment_0";
>a : Symbol(a, Decl(es6ImportNamedImportInExportAssignment_1.ts, 0, 8))
export = a;
>a : Symbol(a, Decl(es6ImportNamedImportInExportAssignment_1.ts, 0, 8))

View File

@@ -0,0 +1,13 @@
=== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts ===
export var a = 10;
>a : number
>10 : number
=== tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts ===
import { a } from "./es6ImportNamedImportInExportAssignment_0";
>a : number
export = a;
>a : number

View File

@@ -1,16 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts (0 errors) ====
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -12,10 +12,13 @@ export class A
}
//// [es6ModuleWithModuleGenTargetAmd.js]
export class A {
constructor() {
define(["require", "exports"], function (require, exports) {
class A {
constructor() {
}
B() {
return 42;
}
}
B() {
return 42;
}
}
exports.A = A;
});

View File

@@ -0,0 +1,14 @@
=== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts ===
export class A
>A : Symbol(A, Decl(es6ModuleWithModuleGenTargetAmd.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6ModuleWithModuleGenTargetAmd.ts, 4, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts ===
export class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,16 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts (0 errors) ====
export class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -12,10 +12,11 @@ export class A
}
//// [es6ModuleWithModuleGenTargetCommonjs.js]
export class A {
class A {
constructor() {
}
B() {
return 42;
}
}
exports.A = A;

View File

@@ -0,0 +1,14 @@
=== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts ===
export class A
>A : Symbol(A, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 4, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts ===
export class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -0,0 +1,23 @@
//// [es6modulekind.ts]
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}
//// [es6modulekind.js]
export default class A {
constructor() {
}
B() {
return 42;
}
}

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/es6modulekind.ts ===
export default class A
>A : Symbol(A, Decl(es6modulekind.ts, 0, 0))
{
constructor ()
{
}
public B()
>B : Symbol(B, Decl(es6modulekind.ts, 6, 5))
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
=== tests/cases/compiler/es6modulekind.ts ===
export default class A
>A : A
{
constructor ()
{
}
public B()
>B : () => number
{
return 42;
>42 : number
}
}

View File

@@ -1,7 +0,0 @@
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/systemModule1.ts (0 errors) ====
export var x = 1;

View File

@@ -3,4 +3,12 @@
export var x = 1;
//// [systemModule1.js]
export var x = 1;
System.register([], function(exports_1) {
var x;
return {
setters:[],
execute: function() {
x = 1;
}
}
});

View File

@@ -0,0 +1,5 @@
=== tests/cases/compiler/systemModule1.ts ===
export var x = 1;
>x : Symbol(x, Decl(systemModule1.ts, 1, 10))

View File

@@ -0,0 +1,6 @@
=== tests/cases/compiler/systemModule1.ts ===
export var x = 1;
>x : number
>1 : number

View File

@@ -0,0 +1,17 @@
// @target: ES5
// @sourcemap: false
// @declaration: false
// @module: es6
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}

View File

@@ -0,0 +1,17 @@
// @target: ES6
// @sourcemap: false
// @declaration: false
// @module: es6
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
}