51 lines
660 B
Plaintext
51 lines
660 B
Plaintext
|
=== tests/cases/compiler/avoid.ts ===
|
||
|
function f() {
|
||
|
>f : () => void
|
||
|
|
||
|
var x=1;
|
||
|
>x : number
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|
||
|
|