Skip to content

Commit f2ec02b

Browse files
committed
Add additional test to ensure merging more than augmentations still works
1 parent 7409a04 commit f2ec02b

5 files changed

+137
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
tests/cases/conformance/ambient/testB.ts(1,22): error TS2305: Module '"*.foo"' has no exported member 'onlyInA'.
2+
tests/cases/conformance/ambient/testB.ts(1,31): error TS2305: Module '"*.foo"' has no exported member 'alsoOnlyInA'.
3+
4+
5+
==== tests/cases/conformance/ambient/types.ts (0 errors) ====
6+
declare module "*.foo" {
7+
let everywhere: string;
8+
}
9+
10+
11+
==== tests/cases/conformance/ambient/testA.ts (0 errors) ====
12+
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo";
13+
declare module "a.foo" {
14+
let onlyInA: number;
15+
}
16+
17+
==== tests/cases/conformance/ambient/testB.ts (2 errors) ====
18+
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error
19+
~~~~~~~
20+
!!! error TS2305: Module '"*.foo"' has no exported member 'onlyInA'.
21+
~~~~~~~~~~~
22+
!!! error TS2305: Module '"*.foo"' has no exported member 'alsoOnlyInA'.
23+
declare module "a.foo" {
24+
let alsoOnlyInA: number;
25+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//// [tests/cases/conformance/ambient/ambientDeclarationsPatterns_merging2.ts] ////
2+
3+
//// [types.ts]
4+
declare module "*.foo" {
5+
let everywhere: string;
6+
}
7+
8+
9+
//// [testA.ts]
10+
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo";
11+
declare module "a.foo" {
12+
let onlyInA: number;
13+
}
14+
15+
//// [testB.ts]
16+
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error
17+
declare module "a.foo" {
18+
let alsoOnlyInA: number;
19+
}
20+
21+
//// [types.js]
22+
//// [testA.js]
23+
"use strict";
24+
exports.__esModule = true;
25+
//// [testB.js]
26+
"use strict";
27+
exports.__esModule = true;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=== tests/cases/conformance/ambient/types.ts ===
2+
declare module "*.foo" {
3+
>"*.foo" : Symbol("*.foo", Decl(types.ts, 0, 0))
4+
5+
let everywhere: string;
6+
>everywhere : Symbol(everywhere, Decl(types.ts, 1, 5))
7+
}
8+
9+
10+
=== tests/cases/conformance/ambient/testA.ts ===
11+
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo";
12+
>everywhere : Symbol(everywhere, Decl(testA.ts, 0, 8))
13+
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 0, 20))
14+
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testA.ts, 0, 29))
15+
16+
declare module "a.foo" {
17+
>"a.foo" : Symbol("a.foo", Decl(testA.ts, 0, 57), Decl(types.ts, 0, 0), Decl(testB.ts, 0, 57))
18+
19+
let onlyInA: number;
20+
>onlyInA : Symbol(onlyInA, Decl(testA.ts, 2, 5))
21+
}
22+
23+
=== tests/cases/conformance/ambient/testB.ts ===
24+
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error
25+
>everywhere : Symbol(everywhere, Decl(testB.ts, 0, 8))
26+
>onlyInA : Symbol(onlyInA, Decl(testB.ts, 0, 20))
27+
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testB.ts, 0, 29))
28+
29+
declare module "a.foo" {
30+
>"a.foo" : Symbol("a.foo", Decl(testA.ts, 0, 57), Decl(types.ts, 0, 0), Decl(testB.ts, 0, 57))
31+
32+
let alsoOnlyInA: number;
33+
>alsoOnlyInA : Symbol(alsoOnlyInA, Decl(testB.ts, 2, 5))
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=== tests/cases/conformance/ambient/types.ts ===
2+
declare module "*.foo" {
3+
>"*.foo" : typeof import("*.foo")
4+
5+
let everywhere: string;
6+
>everywhere : string
7+
}
8+
9+
10+
=== tests/cases/conformance/ambient/testA.ts ===
11+
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo";
12+
>everywhere : string
13+
>onlyInA : number
14+
>alsoOnlyInA : number
15+
16+
declare module "a.foo" {
17+
>"a.foo" : typeof import("a.foo")
18+
19+
let onlyInA: number;
20+
>onlyInA : number
21+
}
22+
23+
=== tests/cases/conformance/ambient/testB.ts ===
24+
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error
25+
>everywhere : string
26+
>onlyInA : any
27+
>alsoOnlyInA : any
28+
29+
declare module "a.foo" {
30+
>"a.foo" : typeof import("a.foo")
31+
32+
let alsoOnlyInA: number;
33+
>alsoOnlyInA : number
34+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @filename: types.ts
2+
declare module "*.foo" {
3+
let everywhere: string;
4+
}
5+
6+
7+
// @filename: testA.ts
8+
import { everywhere, onlyInA, alsoOnlyInA } from "a.foo";
9+
declare module "a.foo" {
10+
let onlyInA: number;
11+
}
12+
13+
// @filename: testB.ts
14+
import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error
15+
declare module "a.foo" {
16+
let alsoOnlyInA: number;
17+
}

0 commit comments

Comments
 (0)