160 lines
1.8 KiB
Text
160 lines
1.8 KiB
Text
=== tests/cases/conformance/types/any/assignEveryTypeToAny.ts ===
|
|
// all of these are valid
|
|
|
|
var x: any;
|
|
>x : any
|
|
|
|
x = 1;
|
|
>x = 1 : number
|
|
>x : any
|
|
|
|
var a = 2;
|
|
>a : number
|
|
|
|
x = a;
|
|
>x = a : number
|
|
>x : any
|
|
>a : number
|
|
|
|
x = true;
|
|
>x = true : boolean
|
|
>x : any
|
|
|
|
var b = true;
|
|
>b : boolean
|
|
|
|
x = b;
|
|
>x = b : boolean
|
|
>x : any
|
|
>b : boolean
|
|
|
|
x = "";
|
|
>x = "" : string
|
|
>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
|
|
}
|
|
|
|
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 {
|
|
>I : I
|
|
|
|
foo: string;
|
|
>foo : string
|
|
}
|
|
|
|
var g: I;
|
|
>g : I
|
|
>I : I
|
|
|
|
x = g;
|
|
>x = g : I
|
|
>x : any
|
|
>g : I
|
|
|
|
class C {
|
|
>C : C
|
|
|
|
bar: string;
|
|
>bar : string
|
|
}
|
|
|
|
var h: C;
|
|
>h : C
|
|
>C : 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
|
|
|
|
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
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>x : T
|
|
|
|
function j<T>(a: T) {
|
|
>j : <T>(a: T) => void
|
|
>T : T
|
|
>a : T
|
|
>T : T
|
|
|
|
x = a;
|
|
>x = a : T
|
|
>x : any
|
|
>a : T
|
|
}
|