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
|
=== tests/cases/compiler/constructorsWithSpecializedSignatures.ts ===
// errors
declare class C {
>C : Symbol(C, Decl(constructorsWithSpecializedSignatures.ts, 0, 0))
constructor(x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 2, 16))
constructor(x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 3, 16))
constructor(x: number);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 4, 16))
}
// ok
declare class C2 {
>C2 : Symbol(C2, Decl(constructorsWithSpecializedSignatures.ts, 5, 1))
constructor(x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 9, 16))
constructor(x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 10, 16))
constructor(x: string);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 11, 16))
}
// errors
class D {
>D : Symbol(D, Decl(constructorsWithSpecializedSignatures.ts, 12, 1))
constructor(x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 16, 16))
constructor(x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 17, 16))
constructor(x: number);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 18, 16))
constructor(x: "hi") { }
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 19, 16))
}
// overloads are ok
class D2 {
>D2 : Symbol(D2, Decl(constructorsWithSpecializedSignatures.ts, 20, 1))
constructor(x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 24, 16))
constructor(x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 25, 16))
constructor(x: string);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 26, 16))
constructor(x: "hi") { } // error
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 27, 16))
}
// errors
interface I {
>I : Symbol(I, Decl(constructorsWithSpecializedSignatures.ts, 28, 1))
new (x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 32, 9))
new (x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 33, 9))
new (x: number);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 34, 9))
}
// ok
interface I2 {
>I2 : Symbol(I2, Decl(constructorsWithSpecializedSignatures.ts, 35, 1))
new (x: "hi");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 39, 9))
new (x: "foo");
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 40, 9))
new (x: string);
>x : Symbol(x, Decl(constructorsWithSpecializedSignatures.ts, 41, 9))
}
|