mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
55 lines
2.1 KiB
Plaintext
55 lines
2.1 KiB
Plaintext
methodSignaturesWithOverloads2.ts(13,1): error TS2454: Variable 'c' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(13,11): error TS2454: Variable 'c' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(14,1): error TS2454: Variable 'c' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(14,11): error TS2454: Variable 'c' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(27,1): error TS2454: Variable 'c2' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(27,12): error TS2454: Variable 'c2' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(28,1): error TS2454: Variable 'c2' is used before being assigned.
|
|
methodSignaturesWithOverloads2.ts(28,12): error TS2454: Variable 'c2' is used before being assigned.
|
|
|
|
|
|
==== methodSignaturesWithOverloads2.ts (8 errors) ====
|
|
// Object type literals permit overloads with optionality but they must match
|
|
|
|
var c: {
|
|
func4?(x: number): number;
|
|
func4?(s: string): string;
|
|
func5?: {
|
|
(x: number): number;
|
|
(s: string): string;
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c.func4 = c.func5;
|
|
~
|
|
!!! error TS2454: Variable 'c' is used before being assigned.
|
|
~
|
|
!!! error TS2454: Variable 'c' is used before being assigned.
|
|
c.func5 = c.func4;
|
|
~
|
|
!!! error TS2454: Variable 'c' is used before being assigned.
|
|
~
|
|
!!! error TS2454: Variable 'c' is used before being assigned.
|
|
|
|
|
|
var c2: {
|
|
func4?<T>(x: T): number;
|
|
func4? <T>(s: T): string;
|
|
func5?: {
|
|
<T>(x: T): number;
|
|
<T>(s: T): string;
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c2.func4 = c2.func5;
|
|
~~
|
|
!!! error TS2454: Variable 'c2' is used before being assigned.
|
|
~~
|
|
!!! error TS2454: Variable 'c2' is used before being assigned.
|
|
c2.func5 = c2.func4;
|
|
~~
|
|
!!! error TS2454: Variable 'c2' is used before being assigned.
|
|
~~
|
|
!!! error TS2454: Variable 'c2' is used before being assigned. |