File: capturedParametersInInitializers1.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (3)
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
=== tests/cases/compiler/capturedParametersInInitializers1.ts ===
// ok - usage is deferred
function foo1(y = class {c = x}, x = 1) {
>foo1 : (y?: typeof (Anonymous class), x?: number) => void
>y : typeof (Anonymous class)
>class {c = x} : typeof (Anonymous class)
>c : number
>x : number
>x : number
>1 : 1

    new y().c;
>new y().c : number
>new y() : (Anonymous class)
>y : typeof (Anonymous class)
>c : number
}

// ok - used in file
function foo2(y = function(x: typeof z) {}, z = 1) {
>foo2 : (y?: (x: number) => void, z?: number) => void
>y : (x: number) => void
>function(x: typeof z) {} : (x: number) => void
>x : number
>z : number
>z : number
>1 : 1
    
}

// ok -used in type
let a;
>a : any

function foo3(y = { x: <typeof z>a }, z = 1) {
>foo3 : (y?: { x: number; }, z?: number) => void
>y : { x: number; }
>{ x: <typeof z>a } : { x: number; }
>x : number
><typeof z>a : number
>z : number
>a : any
>z : number
>1 : 1
    
}