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 108 109
|
//// [tests/cases/compiler/duplicateIdentifiersAcrossFileBoundaries.ts] ////
//// [file1.ts]
interface I { }
class C1 { }
class C2 { }
function f() { }
var v = 3;
class Foo {
static x: number;
}
module N {
export module F {
var t;
}
}
//// [file2.ts]
class I { } // error -- cannot merge interface with non-ambient class
interface C1 { } // error -- cannot merge interface with non-ambient class
function C2() { } // error -- cannot merge function with non-ambient class
class f { } // error -- cannot merge function with non-ambient class
var v = 3;
module Foo {
export var x: number; // error for redeclaring var in a different parent
}
declare module N {
export function F(); // no error because function is ambient
}
//// [file1.js]
var C1 = /** @class */ (function () {
function C1() {
}
return C1;
}());
var C2 = /** @class */ (function () {
function C2() {
}
return C2;
}());
function f() { }
var v = 3;
var Foo = /** @class */ (function () {
function Foo() {
}
return Foo;
}());
var N;
(function (N) {
var F;
(function (F) {
var t;
})(F = N.F || (N.F = {}));
})(N || (N = {}));
//// [file2.js]
var I = /** @class */ (function () {
function I() {
}
return I;
}()); // error -- cannot merge interface with non-ambient class
function C2() { } // error -- cannot merge function with non-ambient class
var f = /** @class */ (function () {
function f() {
}
return f;
}()); // error -- cannot merge function with non-ambient class
var v = 3;
var Foo;
(function (Foo) {
})(Foo || (Foo = {}));
//// [file1.d.ts]
interface I {
}
declare class C1 {
}
declare class C2 {
}
declare function f(): void;
declare var v: number;
declare class Foo {
static x: number;
}
declare module N {
module F {
}
}
//// [file2.d.ts]
declare class I {
}
interface C1 {
}
declare function C2(): void;
declare class f {
}
declare var v: number;
declare module Foo {
var x: number;
}
declare module N {
function F(): any;
}
|