// any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted
interface I {
>I : I
[x: string]: any;
>x : string
foo: any; // ok, any identical to itself
>foo : any
}
var a: any;
>a : any
declare function foo2(x: number): number;
>foo2 : { (x: number): number; (x: any): any; }
>x : number
declare function foo2(x: any): any;
>foo2 : { (x: number): number; (x: any): any; }
>x : any
var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload)
>r3 : any
>foo2(a) : any
>foo2 : { (x: number): number; (x: any): any; }
>a : any
declare function foo3(x: string): string;
>foo3 : { (x: string): string; (x: any): any; }
>x : string
declare function foo3(x: any): any;
>foo3 : { (x: string): string; (x: any): any; }
>x : any
var r3 = foo3(a); // any
>r3 : any
>foo3(a) : any
>foo3 : { (x: string): string; (x: any): any; }
>a : any
declare function foo4(x: boolean): boolean;
>foo4 : { (x: boolean): boolean; (x: any): any; }
>x : boolean
declare function foo4(x: any): any;
>foo4 : { (x: boolean): boolean; (x: any): any; }
>x : any
var r3 = foo3(a); // any
>r3 : any
>foo3(a) : any
>foo3 : { (x: string): string; (x: any): any; }
>a : any
declare function foo5(x: Date): Date;
>foo5 : { (x: Date): Date; (x: any): any; }
>x : Date
>Date : Date
>Date : Date
declare function foo5(x: any): any;
>foo5 : { (x: Date): Date; (x: any): any; }
>x : any
var r3 = foo3(a); // any
>r3 : any
>foo3(a) : any
>foo3 : { (x: string): string; (x: any): any; }
>a : any
declare function foo6(x: RegExp): RegExp;
>foo6 : { (x: RegExp): RegExp; (x: any): any; }
>x : RegExp
>RegExp : RegExp
>RegExp : RegExp
declare function foo6(x: any): any;
>foo6 : { (x: RegExp): RegExp; (x: any): any; }
>x : any
var r3 = foo3(a); // any
>r3 : any
>foo3(a) : any
>foo3 : { (x: string): string; (x: any): any; }
>a : any
declare function foo7(x: { bar: number }): { bar: number };
>foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; }
>x : { bar: number; }
>bar : number
>bar : number
declare function foo7(x: any): any;
>foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; }