File: stringLiteralTypesInImplementationSignatures.types

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (69 lines) | stat: -rw-r--r-- 1,546 bytes parent folder | download | duplicates (4)
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
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts ===
// String literal types are only valid in overload signatures

function foo(x: 'hi') { }
>foo : (x: 'hi') => void
>x : "hi"

var f = function foo(x: 'hi') { }
>f : (x: 'hi') => void
>function foo(x: 'hi') { } : (x: 'hi') => void
>foo : (x: 'hi') => void
>x : "hi"

var f2 = (x: 'hi', y: 'hi') => { }
>f2 : (x: 'hi', y: 'hi') => void
>(x: 'hi', y: 'hi') => { } : (x: 'hi', y: 'hi') => void
>x : "hi"
>y : "hi"

class C {
>C : C

    foo(x: 'hi') { }
>foo : (x: 'hi') => void
>x : "hi"
}

interface I {
    (x: 'hi');
>x : "hi"

    foo(x: 'hi', y: 'hi');
>foo : (x: 'hi', y: 'hi') => any
>x : "hi"
>y : "hi"
}

var a: {
>a : { (x: 'hi'): any; foo(x: 'hi'): any; }

    (x: 'hi');
>x : "hi"

    foo(x: 'hi');
>foo : (x: 'hi') => any
>x : "hi"
}

var b = {
>b : { foo(x: 'hi'): void; a: (x: 'hi', y: 'hi') => void; b: (x: 'hi') => void; }
>{    foo(x: 'hi') { },    a: function foo(x: 'hi', y: 'hi') { },    b: (x: 'hi') => { }} : { foo(x: 'hi'): void; a: (x: 'hi', y: 'hi') => void; b: (x: 'hi') => void; }

    foo(x: 'hi') { },
>foo : (x: 'hi') => void
>x : "hi"

    a: function foo(x: 'hi', y: 'hi') { },
>a : (x: 'hi', y: 'hi') => void
>function foo(x: 'hi', y: 'hi') { } : (x: 'hi', y: 'hi') => void
>foo : (x: 'hi', y: 'hi') => void
>x : "hi"
>y : "hi"

    b: (x: 'hi') => { }
>b : (x: 'hi') => void
>(x: 'hi') => { } : (x: 'hi') => void
>x : "hi"
}