mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Test cases that address https://github.com/Microsoft/TypeScript/issues/4288
This commit is contained in:
parent
7c8da42230
commit
500861c4f8
35
tests/baselines/reference/extendClassExpressionFromModule.js
Normal file
35
tests/baselines/reference/extendClassExpressionFromModule.js
Normal file
@ -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);
|
||||
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
45
tests/baselines/reference/reexportClassDefinition.js
Normal file
45
tests/baselines/reference/reexportClassDefinition.js
Normal file
@ -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);
|
||||
26
tests/baselines/reference/reexportClassDefinition.symbols
Normal file
26
tests/baselines/reference/reexportClassDefinition.symbols
Normal file
@ -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))
|
||||
}
|
||||
|
||||
30
tests/baselines/reference/reexportClassDefinition.types
Normal file
30
tests/baselines/reference/reexportClassDefinition.types
Normal file
@ -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
|
||||
}
|
||||
|
||||
@ -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 {}
|
||||
@ -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 {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user