File: objectLiteralFunctionArgContextualTyping2.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (68 lines) | stat: -rw-r--r-- 1,628 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts ===
interface I2 {
    value: string;
>value : string

    doStuff: (t: string) => string;
>doStuff : (t: string) => string
>t : string
}

function f2(args: I2) { }
>f2 : (args: I2) => void
>args : I2

f2({ hello: 1 }) 
>f2({ hello: 1 }) : void
>f2 : (args: I2) => void
>{ hello: 1 } : { hello: number; }
>hello : number
>1 : 1

f2({ value: '' })
>f2({ value: '' }) : void
>f2 : (args: I2) => void
>{ value: '' } : { value: string; }
>value : string
>'' : ""

f2({ value: '', what: 1 }) 
>f2({ value: '', what: 1 }) : void
>f2 : (args: I2) => void
>{ value: '', what: 1 } : { value: string; what: number; }
>value : string
>'' : ""
>what : number
>1 : 1

f2({ toString: (s) => s }) 
>f2({ toString: (s) => s }) : void
>f2 : (args: I2) => void
>{ toString: (s) => s } : { toString: (s: any) => any; }
>toString : (s: any) => any
>(s) => s : (s: any) => any
>s : any
>s : any

f2({ toString: (s: string) => s }) 
>f2({ toString: (s: string) => s }) : void
>f2 : (args: I2) => void
>{ toString: (s: string) => s } : { toString: (s: string) => string; }
>toString : (s: string) => string
>(s: string) => s : (s: string) => string
>s : string
>s : string

f2({ value: '', toString: (s) => s.uhhh }) 
>f2({ value: '', toString: (s) => s.uhhh }) : void
>f2 : (args: I2) => void
>{ value: '', toString: (s) => s.uhhh } : { value: string; toString: (s: any) => any; }
>value : string
>'' : ""
>toString : (s: any) => any
>(s) => s.uhhh : (s: any) => any
>s : any
>s.uhhh : any
>s : any
>uhhh : any