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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
=== tests/cases/conformance/types/any/assignEveryTypeToAny.ts ===
// all of these are valid
var x: any;
>x : any
x = 1;
>x = 1 : 1
>x : any
>1 : 1
var a = 2;
>a : number
>2 : 2
x = a;
>x = a : number
>x : any
>a : number
x = true;
>x = true : true
>x : any
>true : true
var b = true;
>b : boolean
>true : true
x = b;
>x = b : true
>x : any
>b : true
x = "";
>x = "" : ""
>x : any
>"" : ""
var c = "";
>c : string
>"" : ""
x = c;
>x = c : string
>x : any
>c : string
var d: void;
>d : void
x = d;
>x = d : void
>x : any
>d : void
var e = undefined;
>e : any
>undefined : undefined
x = e;
>x = e : any
>x : any
>e : any
var e2: typeof undefined;
>e2 : any
>undefined : undefined
x = e2;
>x = e2 : any
>x : any
>e2 : any
enum E {
>E : E
A
>A : E.A
}
x = E.A;
>x = E.A : E
>x : any
>E.A : E
>E : typeof E
>A : E
var f = E.A;
>f : E
>E.A : E
>E : typeof E
>A : E
x = f;
>x = f : E
>x : any
>f : E
interface I {
foo: string;
>foo : string
}
var g: I;
>g : I
x = g;
>x = g : I
>x : any
>g : I
class C {
>C : C
bar: string;
>bar : string
}
var h: C;
>h : C
x = h;
>x = h : C
>x : any
>h : C
var i: { (): string };
>i : () => string
x = i;
>x = i : () => string
>x : any
>i : () => string
x = { f() { return 1; } }
>x = { f() { return 1; } } : { f(): number; }
>x : any
>{ f() { return 1; } } : { f(): number; }
>f : () => number
>1 : 1
x = { f<T>(x: T) { return x; } }
>x = { f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
>x : any
>{ f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
>f : <T>(x: T) => T
>x : T
>x : T
function j<T>(a: T) {
>j : <T>(a: T) => void
>a : T
x = a;
>x = a : T
>x : any
>a : T
}
|