1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
//// [duplicateSymbolsExportMatching.ts]
module M {
export interface E { }
interface I { }
}
module M {
export interface E { } // ok
interface I { } // ok
}
// Doesn't match export visibility, but it's in a different parent, so it's ok
module M {
interface E { } // ok
export interface I { } // ok
}
module N {
interface I { }
interface I { } // ok
export interface E { }
export interface E { } // ok
}
module N2 {
interface I { }
export interface I { } // error
export interface E { }
interface E { } // error
}
// Should report error only once for instantiated module
module M {
module inst {
var t;
}
export module inst { // one error
var t;
}
}
// Variables of the same / different type
module M2 {
var v: string;
export var v: string; // one error (visibility)
var w: number;
export var w: string; // two errors (visibility and type mismatch)
}
module M {
module F {
var t;
}
export function F() { } // Only one error for duplicate identifier (don't consider visibility)
}
module M {
class C { }
module C { }
export module C { // Two visibility errors (one for the clodule symbol, and one for the merged container symbol)
var t;
}
}
// Top level
interface D { }
export interface D { }
//// [duplicateSymbolsExportMatching.js]
define(["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
// Should report error only once for instantiated module
var M;
(function (M) {
var inst;
(function (inst) {
var t;
})(inst || (inst = {}));
(function (inst) {
var t;
})(inst = M.inst || (M.inst = {}));
})(M || (M = {}));
// Variables of the same / different type
var M2;
(function (M2) {
var v;
var w;
})(M2 || (M2 = {}));
(function (M) {
var F;
(function (F) {
var t;
})(F || (F = {}));
function F() { } // Only one error for duplicate identifier (don't consider visibility)
M.F = F;
})(M || (M = {}));
(function (M) {
var C = /** @class */ (function () {
function C() {
}
return C;
}());
(function (C) {
var t;
})(C = M.C || (M.C = {}));
})(M || (M = {}));
});
|