Fix #5844 - add many new tests covering named/anonymous default exports

This commit is contained in:
Wesley Wigham 2015-12-01 14:05:46 -08:00
parent 5e86ca1ba8
commit cff83c5081
49 changed files with 548 additions and 66 deletions

View File

@ -4273,7 +4273,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
if (node.kind === SyntaxKind.FunctionDeclaration) {
// Emit name if one is present, or emit generated name in down-level case (for export default case)
return !!node.name || languageVersion < ScriptTarget.ES6;
return !!node.name || modulekind !== ModuleKind.ES6;
}
}
@ -5108,7 +5108,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// emit name if
// - node has a name
// - this is default export with static initializers
if ((node.name || (node.flags & NodeFlags.Default && staticProperties.length > 0)) && !thisNodeIsDecorated) {
if ((node.name || (node.flags & NodeFlags.Default && (staticProperties.length > 0 || modulekind !== ModuleKind.ES6))) && !thisNodeIsDecorated) {
write(" ");
emitDeclarationName(node);
}

View File

@ -0,0 +1,21 @@
//// [tests/cases/conformance/es6/moduleExportsAmd/anonymousDefaultExportsAmd.ts] ////
//// [a.ts]
export default class {}
//// [b.ts]
export default function() {}
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
class default_1 {
}
exports.default = default_1;
});
//// [b.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function default_1() { }
exports.default = default_1;
});

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,17 @@
//// [tests/cases/conformance/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs.ts] ////
//// [a.ts]
export default class {}
//// [b.ts]
export default function() {}
//// [a.js]
"use strict";
class default_1 {
}
exports.default = default_1;
//// [b.js]
"use strict";
function default_1() { }
exports.default = default_1;

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,32 @@
//// [tests/cases/conformance/es6/moduleExportsSystem/anonymousDefaultExportsSystem.ts] ////
//// [a.ts]
export default class {}
//// [b.ts]
export default function() {}
//// [a.js]
System.register([], function(exports_1) {
"use strict";
var default_1;
return {
setters:[],
execute: function() {
class default_1 {
}
exports_1("default", default_1);
}
}
});
//// [b.js]
System.register([], function(exports_1) {
"use strict";
function default_1() { }
exports_1("default", default_1);
return {
setters:[],
execute: function() {
}
}
});

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,35 @@
//// [tests/cases/conformance/es6/moduleExportsUmd/anonymousDefaultExportsUmd.ts] ////
//// [a.ts]
export default class {}
//// [b.ts]
export default function() {}
//// [a.js]
(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
class default_1 {
}
exports.default = default_1;
});
//// [b.js]
(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
function default_1() { }
exports.default = default_1;
});

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
export default function() {}
No type information for this code.

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
export default class {}
No type information for this code.
No type information for this code.=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
export default function() {}
No type information for this code.

View File

@ -1,12 +1,19 @@
//// [decoratedDefaultExportsGetExportedAmd.ts]
//// [tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts] ////
//// [a.ts]
var decorator: ClassDecorator;
@decorator
export default class Foo {}
//// [b.ts]
var decorator: ClassDecorator;
@decorator
export default class {}
//// [decoratedDefaultExportsGetExportedAmd.js]
//// [a.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -23,3 +30,20 @@ define(["require", "exports"], function (require, exports) {
], Foo);
exports.default = Foo;
});
//// [b.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports"], function (require, exports) {
"use strict";
var decorator;
let default_1 = class {
};
default_1 = __decorate([
decorator
], default_1);
exports.default = default_1;
});

View File

@ -1,12 +1,21 @@
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
export default class Foo {}
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 30))
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
export default class {}

View File

@ -1,5 +1,4 @@
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@ -10,3 +9,13 @@ var decorator: ClassDecorator;
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@decorator
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
export default class {}

View File

@ -1,12 +1,19 @@
//// [decoratedDefaultExportsGetExportedCommonjs.ts]
//// [tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts] ////
//// [a.ts]
var decorator: ClassDecorator;
@decorator
export default class Foo {}
//// [b.ts]
var decorator: ClassDecorator;
@decorator
export default class {}
//// [decoratedDefaultExportsGetExportedCommonjs.js]
//// [a.js]
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -21,3 +28,18 @@ Foo = __decorate([
decorator
], Foo);
exports.default = Foo;
//// [b.js]
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var decorator;
let default_1 = class {
};
default_1 = __decorate([
decorator
], default_1);
exports.default = default_1;

View File

@ -1,12 +1,21 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
export default class Foo {}
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 30))
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
export default class {}

View File

@ -1,5 +1,4 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@ -10,3 +9,13 @@ var decorator: ClassDecorator;
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@decorator
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
export default class {}

View File

@ -1,12 +1,18 @@
//// [decoratedDefaultExportsGetExportedSystem.ts]
//// [tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts] ////
//// [a.ts]
var decorator: ClassDecorator;
@decorator
export default class Foo {}
//// [b.ts]
var decorator: ClassDecorator;
@decorator
export default class {}
//// [decoratedDefaultExportsGetExportedSystem.js]
//// [a.js]
System.register([], function(exports_1) {
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@ -28,3 +34,25 @@ System.register([], function(exports_1) {
}
}
});
//// [b.js]
System.register([], function(exports_1) {
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var decorator, default_1;
return {
setters:[],
execute: function() {
let default_1 = class {
};
default_1 = __decorate([
decorator
], default_1);
exports_1("default", default_1);
}
}
});

View File

@ -1,12 +1,20 @@
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
export default class Foo {}
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 30))
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
export default class {}

View File

@ -1,5 +1,4 @@
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@ -10,3 +9,12 @@ var decorator: ClassDecorator;
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@decorator
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
export default class {}

View File

@ -1,12 +1,19 @@
//// [decoratedDefaultExportsGetExportedUmd.ts]
//// [tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts] ////
//// [a.ts]
var decorator: ClassDecorator;
@decorator
export default class Foo {}
//// [b.ts]
var decorator: ClassDecorator;
@decorator
export default class {}
//// [decoratedDefaultExportsGetExportedUmd.js]
//// [a.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -30,3 +37,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
], Foo);
exports.default = Foo;
});
//// [b.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
var decorator;
let default_1 = class {
};
default_1 = __decorate([
decorator
], default_1);
exports.default = default_1;
});

View File

@ -1,12 +1,21 @@
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
export default class Foo {}
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 30))
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
var decorator: ClassDecorator;
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
@decorator
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
export default class {}

View File

@ -1,5 +1,4 @@
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@ -10,3 +9,13 @@ var decorator: ClassDecorator;
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
var decorator: ClassDecorator;
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
@decorator
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
export default class {}

View File

@ -1,11 +1,22 @@
//// [defaultExportsGetExportedAmd.ts]
//// [tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts] ////
//// [a.ts]
export default class Foo {}
//// [b.ts]
export default function foo() {}
//// [defaultExportsGetExportedAmd.js]
//// [a.js]
define(["require", "exports"], function (require, exports) {
"use strict";
class Foo {
}
exports.default = Foo;
});
//// [b.js]
define(["require", "exports"], function (require, exports) {
"use strict";
function foo() { }
exports.default = foo;
});

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
export default class Foo {}
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedAmd.ts, 0, 0))
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
export default function foo() {}
>foo : Symbol(foo, Decl(b.ts, 0, 0))

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
export default function foo() {}
>foo : () => void

View File

@ -1,9 +1,18 @@
//// [defaultExportsGetExportedCommonjs.ts]
//// [tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts] ////
//// [a.ts]
export default class Foo {}
//// [b.ts]
export default function foo() {}
//// [defaultExportsGetExportedCommonjs.js]
//// [a.js]
"use strict";
class Foo {
}
exports.default = Foo;
//// [b.js]
"use strict";
function foo() { }
exports.default = foo;

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
export default class Foo {}
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedCommonjs.ts, 0, 0))
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
export default function foo() {}
>foo : Symbol(foo, Decl(b.ts, 0, 0))

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
export default function foo() {}
>foo : () => void

View File

@ -1,8 +1,13 @@
//// [defaultExportsGetExportedSystem.ts]
//// [tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts] ////
//// [a.ts]
export default class Foo {}
//// [b.ts]
export default function foo() {}
//// [defaultExportsGetExportedSystem.js]
//// [a.js]
System.register([], function(exports_1) {
"use strict";
var Foo;
@ -15,3 +20,14 @@ System.register([], function(exports_1) {
}
}
});
//// [b.js]
System.register([], function(exports_1) {
"use strict";
function foo() { }
exports_1("default", foo);
return {
setters:[],
execute: function() {
}
}
});

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
export default class Foo {}
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedSystem.ts, 0, 0))
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
export default function foo() {}
>foo : Symbol(foo, Decl(b.ts, 0, 0))

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
export default function foo() {}
>foo : () => void

View File

@ -1,8 +1,13 @@
//// [defaultExportsGetExportedUmd.ts]
//// [tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts] ////
//// [a.ts]
export default class Foo {}
//// [b.ts]
export default function foo() {}
//// [defaultExportsGetExportedUmd.js]
//// [a.js]
(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
@ -16,3 +21,16 @@ export default class Foo {}
}
exports.default = Foo;
});
//// [b.js]
(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
}
else if (typeof define === 'function' && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
function foo() { }
exports.default = foo;
});

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
export default class Foo {}
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedUmd.ts, 0, 0))
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
export default function foo() {}
>foo : Symbol(foo, Decl(b.ts, 0, 0))

View File

@ -1,4 +1,8 @@
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
export default class Foo {}
>Foo : Foo
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
export default function foo() {}
>foo : () => void

View File

@ -0,0 +1,7 @@
// @target: ES6
// @module: amd
// @filename: a.ts
export default class {}
// @filename: b.ts
export default function() {}

View File

@ -1,8 +1,14 @@
// @target: ES6
// @experimentalDecorators: true
// @module: amd
// @filename: a.ts
var decorator: ClassDecorator;
@decorator
export default class Foo {}
// @filename: b.ts
var decorator: ClassDecorator;
@decorator
export default class {}

View File

@ -1,3 +1,7 @@
// @target: ES6
// @module: amd
// @filename: a.ts
export default class Foo {}
// @filename: b.ts
export default function foo() {}

View File

@ -0,0 +1,7 @@
// @target: ES6
// @module: commonjs
// @filename: a.ts
export default class {}
// @filename: b.ts
export default function() {}

View File

@ -1,8 +1,14 @@
// @target: ES6
// @experimentalDecorators: true
// @module: commonjs
// @filename: a.ts
var decorator: ClassDecorator;
@decorator
export default class Foo {}
// @filename: b.ts
var decorator: ClassDecorator;
@decorator
export default class {}

View File

@ -1,3 +1,7 @@
// @target: ES6
// @module: commonjs
// @filename: a.ts
export default class Foo {}
// @filename: b.ts
export default function foo() {}

View File

@ -0,0 +1,7 @@
// @target: ES6
// @module: system
// @filename: a.ts
export default class {}
// @filename: b.ts
export default function() {}

View File

@ -1,8 +1,14 @@
// @target: ES6
// @experimentalDecorators: true
// @module: system
// @filename: a.ts
var decorator: ClassDecorator;
@decorator
export default class Foo {}
// @filename: b.ts
var decorator: ClassDecorator;
@decorator
export default class {}

View File

@ -1,3 +1,7 @@
// @target: ES6
// @module: system
// @filename: a.ts
export default class Foo {}
// @filename: b.ts
export default function foo() {}

View File

@ -0,0 +1,7 @@
// @target: ES6
// @module: umd
// @filename: a.ts
export default class {}
// @filename: b.ts
export default function() {}

View File

@ -1,8 +1,14 @@
// @target: ES6
// @experimentalDecorators: true
// @module: umd
// @filename: a.ts
var decorator: ClassDecorator;
@decorator
export default class Foo {}
// @filename: b.ts
var decorator: ClassDecorator;
@decorator
export default class {}

View File

@ -1,3 +1,7 @@
// @target: ES6
// @module: umd
// @filename: a.ts
export default class Foo {}
// @filename: b.ts
export default function foo() {}