mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
constructSignaturesWithOverloads.ts(25,14): error TS2454: Variable 'i' is used before being assigned.
|
|
constructSignaturesWithOverloads.ts(36,14): error TS2454: Variable 'i2' is used before being assigned.
|
|
constructSignaturesWithOverloads.ts(43,14): error TS2454: Variable 'a' is used before being assigned.
|
|
constructSignaturesWithOverloads.ts(50,14): error TS2454: Variable 'b' is used before being assigned.
|
|
|
|
|
|
==== constructSignaturesWithOverloads.ts (4 errors) ====
|
|
// No errors expected for basic overloads of construct signatures
|
|
|
|
class C {
|
|
constructor(x: number, y?: string);
|
|
constructor(x: number, y: string);
|
|
constructor(x: number) { }
|
|
}
|
|
|
|
var r1 = new C(1, '');
|
|
|
|
class C2<T> {
|
|
constructor(x: T, y?: string);
|
|
constructor(x: T, y: string);
|
|
constructor(x: T) { }
|
|
}
|
|
|
|
var r2 = new C2(1, '');
|
|
|
|
interface I {
|
|
new(x: number, y?: string): C;
|
|
new(x: number, y: string): C;
|
|
}
|
|
|
|
var i: I;
|
|
var r3 = new i(1, '');
|
|
~
|
|
!!! error TS2454: Variable 'i' is used before being assigned.
|
|
|
|
interface I2<T> {
|
|
new (x: T, y?: string): C2<T>;
|
|
new (x: T, y: string): C2<T>;
|
|
new <T>(x: T, y?: string): C2<T>;
|
|
new <T>(x: T, y: string): C2<T>;
|
|
|
|
}
|
|
|
|
var i2: I2<number>;
|
|
var r4 = new i2(1, '');
|
|
~~
|
|
!!! error TS2454: Variable 'i2' is used before being assigned.
|
|
|
|
var a: {
|
|
new(x: number, y?: string): C;
|
|
new(x: number, y: string): C;
|
|
}
|
|
|
|
var r5 = new a(1, '');
|
|
~
|
|
!!! error TS2454: Variable 'a' is used before being assigned.
|
|
|
|
var b: {
|
|
new<T>(x: T, y?: string): C2<T>;
|
|
new<T>(x: T, y: string): C2<T>;
|
|
}
|
|
|
|
var r6 = new b(1, '');
|
|
~
|
|
!!! error TS2454: Variable 'b' is used before being assigned. |