92 lines
4.4 KiB
Text
92 lines
4.4 KiB
Text
=== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/methodSignaturesWithOverloads2.ts ===
|
|
// Object type literals permit overloads with optionality but they must match
|
|
|
|
var c: {
|
|
>c : Symbol(c, Decl(methodSignaturesWithOverloads2.ts, 2, 3))
|
|
|
|
func4?(x: number): number;
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
>x : Symbol(x, Decl(methodSignaturesWithOverloads2.ts, 3, 11))
|
|
|
|
func4?(s: string): string;
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
>s : Symbol(s, Decl(methodSignaturesWithOverloads2.ts, 4, 11))
|
|
|
|
func5?: {
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 4, 30))
|
|
|
|
(x: number): number;
|
|
>x : Symbol(x, Decl(methodSignaturesWithOverloads2.ts, 6, 9))
|
|
|
|
(s: string): string;
|
|
>s : Symbol(s, Decl(methodSignaturesWithOverloads2.ts, 7, 9))
|
|
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c.func4 = c.func5;
|
|
>c.func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
>c : Symbol(c, Decl(methodSignaturesWithOverloads2.ts, 2, 3))
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
>c.func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 4, 30))
|
|
>c : Symbol(c, Decl(methodSignaturesWithOverloads2.ts, 2, 3))
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 4, 30))
|
|
|
|
c.func5 = c.func4;
|
|
>c.func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 4, 30))
|
|
>c : Symbol(c, Decl(methodSignaturesWithOverloads2.ts, 2, 3))
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 4, 30))
|
|
>c.func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
>c : Symbol(c, Decl(methodSignaturesWithOverloads2.ts, 2, 3))
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 2, 8), Decl(methodSignaturesWithOverloads2.ts, 3, 30))
|
|
|
|
|
|
var c2: {
|
|
>c2 : Symbol(c2, Decl(methodSignaturesWithOverloads2.ts, 16, 3))
|
|
|
|
func4?<T>(x: T): number;
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 17, 11))
|
|
>x : Symbol(x, Decl(methodSignaturesWithOverloads2.ts, 17, 14))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 17, 11))
|
|
|
|
func4? <T>(s: T): string;
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 18, 12))
|
|
>s : Symbol(s, Decl(methodSignaturesWithOverloads2.ts, 18, 15))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 18, 12))
|
|
|
|
func5?: {
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 18, 29))
|
|
|
|
<T>(x: T): number;
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 20, 9))
|
|
>x : Symbol(x, Decl(methodSignaturesWithOverloads2.ts, 20, 12))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 20, 9))
|
|
|
|
<T>(s: T): string;
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 21, 9))
|
|
>s : Symbol(s, Decl(methodSignaturesWithOverloads2.ts, 21, 12))
|
|
>T : Symbol(T, Decl(methodSignaturesWithOverloads2.ts, 21, 9))
|
|
|
|
};
|
|
};
|
|
|
|
// no errors
|
|
c2.func4 = c2.func5;
|
|
>c2.func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
>c2 : Symbol(c2, Decl(methodSignaturesWithOverloads2.ts, 16, 3))
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
>c2.func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 18, 29))
|
|
>c2 : Symbol(c2, Decl(methodSignaturesWithOverloads2.ts, 16, 3))
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 18, 29))
|
|
|
|
c2.func5 = c2.func4;
|
|
>c2.func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 18, 29))
|
|
>c2 : Symbol(c2, Decl(methodSignaturesWithOverloads2.ts, 16, 3))
|
|
>func5 : Symbol(func5, Decl(methodSignaturesWithOverloads2.ts, 18, 29))
|
|
>c2.func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
>c2 : Symbol(c2, Decl(methodSignaturesWithOverloads2.ts, 16, 3))
|
|
>func4 : Symbol(func4, Decl(methodSignaturesWithOverloads2.ts, 16, 9), Decl(methodSignaturesWithOverloads2.ts, 17, 28))
|
|
|