Skip to content

Commit 5c49133

Browse files
authored
Add regression tests documenting current behavior of #14121 (#22748)
1 parent 65659d7 commit 5c49133

4 files changed

+130
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//// [tests/cases/compiler/exportAssignmentMembersVisibleInAugmentation.ts] ////
2+
3+
//// [index.d.ts]
4+
export = foo;
5+
declare namespace foo {
6+
export type T = number;
7+
}
8+
9+
//// [a.ts]
10+
import * as foo from "foo";
11+
declare module "foo" {
12+
export function f(): T; // OK
13+
}
14+
15+
//// [b.ts]
16+
import * as foo from "foo";
17+
declare module "foo" {
18+
export function g(): foo.T; // OK
19+
}
20+
21+
22+
//// [a.js]
23+
"use strict";
24+
exports.__esModule = true;
25+
//// [b.js]
26+
"use strict";
27+
exports.__esModule = true;
28+
29+
30+
//// [a.d.ts]
31+
declare module "foo" {
32+
function f(): T;
33+
}
34+
export {};
35+
//// [b.d.ts]
36+
import * as foo from "foo";
37+
declare module "foo" {
38+
function g(): foo.T;
39+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
=== /node_modules/foo/index.d.ts ===
2+
export = foo;
3+
>foo : Symbol(foo, Decl(index.d.ts, 0, 13))
4+
5+
declare namespace foo {
6+
>foo : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
7+
8+
export type T = number;
9+
>T : Symbol(T, Decl(index.d.ts, 1, 23))
10+
}
11+
12+
=== /a.ts ===
13+
import * as foo from "foo";
14+
>foo : Symbol(foo, Decl(a.ts, 0, 6))
15+
16+
declare module "foo" {
17+
>"foo" : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
18+
19+
export function f(): T; // OK
20+
>f : Symbol(f, Decl(a.ts, 1, 22))
21+
>T : Symbol(T, Decl(index.d.ts, 1, 23))
22+
}
23+
24+
=== /b.ts ===
25+
import * as foo from "foo";
26+
>foo : Symbol(foo, Decl(b.ts, 0, 6))
27+
28+
declare module "foo" {
29+
>"foo" : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
30+
31+
export function g(): foo.T; // OK
32+
>g : Symbol(g, Decl(b.ts, 1, 22))
33+
>foo : Symbol(foo, Decl(b.ts, 0, 6))
34+
>T : Symbol(T, Decl(index.d.ts, 1, 23))
35+
}
36+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
=== /node_modules/foo/index.d.ts ===
2+
export = foo;
3+
>foo : any
4+
5+
declare namespace foo {
6+
>foo : typeof foo
7+
8+
export type T = number;
9+
>T : number
10+
}
11+
12+
=== /a.ts ===
13+
import * as foo from "foo";
14+
>foo : typeof foo
15+
16+
declare module "foo" {
17+
>"foo" : typeof foo
18+
19+
export function f(): T; // OK
20+
>f : () => number
21+
>T : number
22+
}
23+
24+
=== /b.ts ===
25+
import * as foo from "foo";
26+
>foo : typeof foo
27+
28+
declare module "foo" {
29+
>"foo" : typeof foo
30+
31+
export function g(): foo.T; // OK
32+
>g : () => number
33+
>foo : any
34+
>T : number
35+
}
36+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// @declaration: true
2+
3+
// @Filename: /node_modules/foo/index.d.ts
4+
export = foo;
5+
declare namespace foo {
6+
export type T = number;
7+
}
8+
9+
// @Filename: /a.ts
10+
import * as foo from "foo";
11+
declare module "foo" {
12+
export function f(): T; // OK
13+
}
14+
15+
// @Filename: /b.ts
16+
import * as foo from "foo";
17+
declare module "foo" {
18+
export function g(): foo.T; // OK
19+
}

0 commit comments

Comments
 (0)