Add test case
This commit is contained in:
parent
4ecf4f4e71
commit
12b7a998e9
38
tests/baselines/reference/moduleMergeConstructor.js
Normal file
38
tests/baselines/reference/moduleMergeConstructor.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
//// [tests/cases/compiler/moduleMergeConstructor.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
declare module "foo" {
|
||||
export class Foo {
|
||||
// constructor(): Foo;
|
||||
method1(): any;
|
||||
}
|
||||
}
|
||||
|
||||
//// [foo-ext.d.ts]
|
||||
declare module "foo" {
|
||||
export interface Foo {
|
||||
method2(): any;
|
||||
}
|
||||
}
|
||||
|
||||
//// [index.ts]
|
||||
import * as foo from "foo";
|
||||
|
||||
class Test {
|
||||
bar: foo.Foo;
|
||||
constructor() {
|
||||
this.bar = new foo.Foo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [index.js]
|
||||
define(["require", "exports", "foo"], function (require, exports, foo) {
|
||||
var Test = (function () {
|
||||
function Test() {
|
||||
this.bar = new foo.Foo();
|
||||
}
|
||||
return Test;
|
||||
})();
|
||||
});
|
45
tests/baselines/reference/moduleMergeConstructor.symbols
Normal file
45
tests/baselines/reference/moduleMergeConstructor.symbols
Normal file
|
@ -0,0 +1,45 @@
|
|||
=== tests/cases/compiler/foo.d.ts ===
|
||||
|
||||
declare module "foo" {
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
|
||||
|
||||
// constructor(): Foo;
|
||||
method1(): any;
|
||||
>method1 : Symbol(method1, Decl(foo.d.ts, 2, 22))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/foo-ext.d.ts ===
|
||||
declare module "foo" {
|
||||
export interface Foo {
|
||||
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
|
||||
|
||||
method2(): any;
|
||||
>method2 : Symbol(method2, Decl(foo-ext.d.ts, 1, 26))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import * as foo from "foo";
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 6))
|
||||
|
||||
class Test {
|
||||
>Test : Symbol(Test, Decl(index.ts, 0, 27))
|
||||
|
||||
bar: foo.Foo;
|
||||
>bar : Symbol(bar, Decl(index.ts, 2, 12))
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 6))
|
||||
>Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
|
||||
|
||||
constructor() {
|
||||
this.bar = new foo.Foo();
|
||||
>this.bar : Symbol(bar, Decl(index.ts, 2, 12))
|
||||
>this : Symbol(Test, Decl(index.ts, 0, 27))
|
||||
>bar : Symbol(bar, Decl(index.ts, 2, 12))
|
||||
>foo.Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 6))
|
||||
>Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
|
||||
}
|
||||
}
|
||||
|
47
tests/baselines/reference/moduleMergeConstructor.types
Normal file
47
tests/baselines/reference/moduleMergeConstructor.types
Normal file
|
@ -0,0 +1,47 @@
|
|||
=== tests/cases/compiler/foo.d.ts ===
|
||||
|
||||
declare module "foo" {
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
// constructor(): Foo;
|
||||
method1(): any;
|
||||
>method1 : () => any
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/foo-ext.d.ts ===
|
||||
declare module "foo" {
|
||||
export interface Foo {
|
||||
>Foo : Foo
|
||||
|
||||
method2(): any;
|
||||
>method2 : () => any
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import * as foo from "foo";
|
||||
>foo : typeof foo
|
||||
|
||||
class Test {
|
||||
>Test : Test
|
||||
|
||||
bar: foo.Foo;
|
||||
>bar : foo.Foo
|
||||
>foo : any
|
||||
>Foo : foo.Foo
|
||||
|
||||
constructor() {
|
||||
this.bar = new foo.Foo();
|
||||
>this.bar = new foo.Foo() : foo.Foo
|
||||
>this.bar : foo.Foo
|
||||
>this : this
|
||||
>bar : foo.Foo
|
||||
>new foo.Foo() : foo.Foo
|
||||
>foo.Foo : typeof foo.Foo
|
||||
>foo : typeof foo
|
||||
>Foo : typeof foo.Foo
|
||||
}
|
||||
}
|
||||
|
26
tests/cases/compiler/moduleMergeConstructor.ts
Normal file
26
tests/cases/compiler/moduleMergeConstructor.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
// @module: amd
|
||||
|
||||
// @filename: foo.d.ts
|
||||
declare module "foo" {
|
||||
export class Foo {
|
||||
// constructor(): Foo;
|
||||
method1(): any;
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: foo-ext.d.ts
|
||||
declare module "foo" {
|
||||
export interface Foo {
|
||||
method2(): any;
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: index.ts
|
||||
import * as foo from "foo";
|
||||
|
||||
class Test {
|
||||
bar: foo.Foo;
|
||||
constructor() {
|
||||
this.bar = new foo.Foo();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue