diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js new file mode 100644 index 00000000000..cbd36f7e799 --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts] //// + +//// [foo1.ts] +class x{} + +export = x; + +//// [foo2.ts] +import foo1 = require('./foo1'); +var x = foo1; +class y extends x {} + + +//// [foo1.js] +var x = (function () { + function x() { + } + return x; +})(); +module.exports = x; +//// [foo2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var foo1 = require('./foo1'); +var x = foo1; +var y = (function (_super) { + __extends(y, _super); + function y() { + _super.apply(this, arguments); + } + return y; +})(x); diff --git a/tests/baselines/reference/extendClassExpressionFromModule.symbols b/tests/baselines/reference/extendClassExpressionFromModule.symbols new file mode 100644 index 00000000000..c131ea8fa28 --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/classes/classExpressions/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +var x = foo1; +>x : Symbol(x, Decl(foo2.ts, 1, 3)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +class y extends x {} +>y : Symbol(y, Decl(foo2.ts, 1, 13)) + +=== tests/cases/conformance/classes/classExpressions/foo1.ts === +class x{} +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +export = x; +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + diff --git a/tests/baselines/reference/extendClassExpressionFromModule.types b/tests/baselines/reference/extendClassExpressionFromModule.types new file mode 100644 index 00000000000..d03623d50aa --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/classExpressions/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +var x = foo1; +>x : typeof foo1 +>foo1 : typeof foo1 + +class y extends x {} +>y : y +>x : foo1 + +=== tests/cases/conformance/classes/classExpressions/foo1.ts === +class x{} +>x : x + +export = x; +>x : x + diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js new file mode 100644 index 00000000000..5d534f1e3a3 --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/externalModules/reexportClassDefinition.ts] //// + +//// [foo1.ts] +class x{} +export = x; + +//// [foo2.ts] +import foo1 = require('./foo1'); + +export = { + x: foo1 +} + +//// [foo3.ts] +import foo2 = require('./foo2') +class x extends foo2.x {} + + + +//// [foo1.js] +var x = (function () { + function x() { + } + return x; +})(); +module.exports = x; +//// [foo2.js] +var foo1 = require('./foo1'); +module.exports = { + x: foo1 +}; +//// [foo3.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var foo2 = require('./foo2'); +var x = (function (_super) { + __extends(x, _super); + function x() { + _super.apply(this, arguments); + } + return x; +})(foo2.x); diff --git a/tests/baselines/reference/reexportClassDefinition.symbols b/tests/baselines/reference/reexportClassDefinition.symbols new file mode 100644 index 00000000000..52133657985 --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2') +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + +class x extends foo2.x {} +>x : Symbol(x, Decl(foo3.ts, 0, 31)) +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + + +=== tests/cases/conformance/externalModules/foo1.ts === +class x{} +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +export = x; +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +export = { + x: foo1 +>x : Symbol(x, Decl(foo2.ts, 2, 10)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/reexportClassDefinition.types b/tests/baselines/reference/reexportClassDefinition.types new file mode 100644 index 00000000000..c39bbf9c136 --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2') +>foo2 : { x: typeof x; } + +class x extends foo2.x {} +>x : x +>foo2.x : x +>foo2 : { x: typeof x; } +>x : typeof x + + +=== tests/cases/conformance/externalModules/foo1.ts === +class x{} +>x : x + +export = x; +>x : x + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +export = { +>{ x: foo1} : { x: typeof foo1; } + + x: foo1 +>x : typeof foo1 +>foo1 : typeof foo1 +} + diff --git a/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts b/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts new file mode 100644 index 00000000000..d4d25743333 --- /dev/null +++ b/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @Filename: foo1.ts +class x{} + +export = x; + +// @Filename: foo2.ts +import foo1 = require('./foo1'); +var x = foo1; +class y extends x {} diff --git a/tests/cases/conformance/externalModules/reexportClassDefinition.ts b/tests/cases/conformance/externalModules/reexportClassDefinition.ts new file mode 100644 index 00000000000..31d90fd7fd2 --- /dev/null +++ b/tests/cases/conformance/externalModules/reexportClassDefinition.ts @@ -0,0 +1,16 @@ +// @module: commonjs +// @Filename: foo1.ts +class x{} +export = x; + +// @Filename: foo2.ts +import foo1 = require('./foo1'); + +export = { + x: foo1 +} + +// @Filename: foo3.ts +import foo2 = require('./foo2') +class x extends foo2.x {} +