File: avoid.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (51 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (7)
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
=== tests/cases/compiler/avoid.ts ===
function f() {
>f : () => void

    var x=1;
>x : number
>1 : 1
}

var y=f();  // error void fn
>y : void
>f() : void
>f : () => void

var why:any=f(); // error void fn
>why : any
>f() : void
>f : () => void

var w:any;
>w : any

w=f(); // error void fn
>w=f() : void
>w : any
>f() : void
>f : () => void

class C {
>C : C

    g() {
>g : () => void
        
    }
}

var z=new C().g(); // error void fn
>z : void
>new C().g() : void
>new C().g : () => void
>new C() : C
>C : typeof C
>g : () => void

var N=new f();  // ok with void fn
>N : any
>new f() : any
>f : () => void