mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
parent
c72f5e28e8
commit
0116abdcf2
@ -18763,7 +18763,13 @@ namespace ts {
|
||||
(augmentations || (augmentations = [])).push(file.moduleAugmentations);
|
||||
}
|
||||
if (file.symbol && file.symbol.globalExports) {
|
||||
mergeSymbolTable(globals, file.symbol.globalExports);
|
||||
// Merge in UMD exports with first-in-wins semantics (see #9771)
|
||||
const source = file.symbol.globalExports;
|
||||
for (const id in source) {
|
||||
if (!(id in globals)) {
|
||||
globals[id] = source[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
23
tests/baselines/reference/umdGlobalConflict.js
Normal file
23
tests/baselines/reference/umdGlobalConflict.js
Normal file
@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/umdGlobalConflict.ts] ////
|
||||
|
||||
//// [index.d.ts]
|
||||
export as namespace Alpha;
|
||||
export var x: string;
|
||||
|
||||
//// [index.d.ts]
|
||||
export as namespace Alpha;
|
||||
export var y: number;
|
||||
|
||||
//// [consumer.ts]
|
||||
import * as v1 from './v1';
|
||||
import * as v2 from './v2';
|
||||
|
||||
//// [global.ts]
|
||||
// Should be OK, first in wins
|
||||
const p: string = Alpha.x;
|
||||
|
||||
//// [consumer.js]
|
||||
"use strict";
|
||||
//// [global.js]
|
||||
// Should be OK, first in wins
|
||||
var p = Alpha.x;
|
||||
29
tests/baselines/reference/umdGlobalConflict.symbols
Normal file
29
tests/baselines/reference/umdGlobalConflict.symbols
Normal file
@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/v1/index.d.ts ===
|
||||
export as namespace Alpha;
|
||||
>Alpha : Symbol(Alpha, Decl(index.d.ts, 0, 0))
|
||||
|
||||
export var x: string;
|
||||
>x : Symbol(x, Decl(index.d.ts, 1, 10))
|
||||
|
||||
=== tests/cases/compiler/v2/index.d.ts ===
|
||||
export as namespace Alpha;
|
||||
>Alpha : Symbol(Alpha, Decl(index.d.ts, 0, 0))
|
||||
|
||||
export var y: number;
|
||||
>y : Symbol(y, Decl(index.d.ts, 1, 10))
|
||||
|
||||
=== tests/cases/compiler/consumer.ts ===
|
||||
import * as v1 from './v1';
|
||||
>v1 : Symbol(v1, Decl(consumer.ts, 0, 6))
|
||||
|
||||
import * as v2 from './v2';
|
||||
>v2 : Symbol(v2, Decl(consumer.ts, 1, 6))
|
||||
|
||||
=== tests/cases/compiler/global.ts ===
|
||||
// Should be OK, first in wins
|
||||
const p: string = Alpha.x;
|
||||
>p : Symbol(p, Decl(global.ts, 1, 5))
|
||||
>Alpha.x : Symbol(Alpha.x, Decl(index.d.ts, 1, 10))
|
||||
>Alpha : Symbol(Alpha, Decl(index.d.ts, 0, 0))
|
||||
>x : Symbol(Alpha.x, Decl(index.d.ts, 1, 10))
|
||||
|
||||
29
tests/baselines/reference/umdGlobalConflict.types
Normal file
29
tests/baselines/reference/umdGlobalConflict.types
Normal file
@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/v1/index.d.ts ===
|
||||
export as namespace Alpha;
|
||||
>Alpha : typeof Alpha
|
||||
|
||||
export var x: string;
|
||||
>x : string
|
||||
|
||||
=== tests/cases/compiler/v2/index.d.ts ===
|
||||
export as namespace Alpha;
|
||||
>Alpha : typeof
|
||||
|
||||
export var y: number;
|
||||
>y : number
|
||||
|
||||
=== tests/cases/compiler/consumer.ts ===
|
||||
import * as v1 from './v1';
|
||||
>v1 : typeof v1
|
||||
|
||||
import * as v2 from './v2';
|
||||
>v2 : typeof v2
|
||||
|
||||
=== tests/cases/compiler/global.ts ===
|
||||
// Should be OK, first in wins
|
||||
const p: string = Alpha.x;
|
||||
>p : string
|
||||
>Alpha.x : string
|
||||
>Alpha : typeof Alpha
|
||||
>x : string
|
||||
|
||||
15
tests/cases/compiler/umdGlobalConflict.ts
Normal file
15
tests/cases/compiler/umdGlobalConflict.ts
Normal file
@ -0,0 +1,15 @@
|
||||
//@filename: v1/index.d.ts
|
||||
export as namespace Alpha;
|
||||
export var x: string;
|
||||
|
||||
//@filename: v2/index.d.ts
|
||||
export as namespace Alpha;
|
||||
export var y: number;
|
||||
|
||||
//@filename: consumer.ts
|
||||
import * as v1 from './v1';
|
||||
import * as v2 from './v2';
|
||||
|
||||
//@filename: global.ts
|
||||
// Should be OK, first in wins
|
||||
const p: string = Alpha.x;
|
||||
Loading…
x
Reference in New Issue
Block a user