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
|
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts ===
// String literal types are only valid in overload signatures
function foo(x: any);
>foo : (x: any) => any
>x : any
function foo(x: 'hi') { }
>foo : (x: any) => any
>x : "hi"
class C {
>C : C
foo(x: string);
>foo : (x: string) => any
>x : string
foo(x: 'hi') { }
>foo : (x: string) => any
>x : "hi"
}
interface I {
(x: 'a');
>x : "a"
(x: 'hi');
>x : "hi"
foo(x: 'a', y: 'a');
>foo : { (x: 'a', y: 'a'): any; (x: "hi", y: "hi"): any; }
>x : "a"
>y : "a"
foo(x: 'hi', y: 'hi');
>foo : { (x: "a", y: "a"): any; (x: 'hi', y: 'hi'): any; }
>x : "hi"
>y : "hi"
}
var a: {
>a : { (x: 'hi'): any; (x: 'a'): any; foo(x: 'hi'): any; foo(x: 'a'): any; }
(x: 'hi');
>x : "hi"
(x: 'a');
>x : "a"
foo(x: 'hi');
>foo : { (x: 'hi'): any; (x: "a"): any; }
>x : "hi"
foo(x: 'a');
>foo : { (x: "hi"): any; (x: 'a'): any; }
>x : "a"
}
var b = {
>b : { foo(x: 'hi'): void; foo(x: 'a'): void; }
>{ foo(x: 'hi') { }, foo(x: 'a') { },} : { foo(x: 'hi'): void; foo(x: 'a'): void; }
foo(x: 'hi') { },
>foo : { (x: 'hi'): void; (x: "a"): void; }
>x : "hi"
foo(x: 'a') { },
>foo : { (x: "hi"): void; (x: 'a'): void; }
>x : "a"
}
|