2014-07-13 01:04:16 +02:00
|
|
|
//// [subtypesOfAny.ts]
|
|
|
|
// every type is a subtype of any, no errors expected
|
|
|
|
|
|
|
|
interface I {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I2 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I3 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I4 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I5 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: Date;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I6 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: RegExp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I7 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: { bar: number };
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I8 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: number[];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I9 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: I8;
|
|
|
|
}
|
|
|
|
|
|
|
|
class A { foo: number; }
|
|
|
|
interface I10 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: A;
|
|
|
|
}
|
|
|
|
|
|
|
|
class A2<T> { foo: T; }
|
|
|
|
interface I11 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: A2<number>;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I12 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: (x) => number;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I13 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: <T>(x:T) => T;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum E { A }
|
|
|
|
interface I14 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: E;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function f() { }
|
|
|
|
module f {
|
|
|
|
export var bar = 1;
|
|
|
|
}
|
|
|
|
interface I15 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: typeof f;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class c { baz: string }
|
|
|
|
module c {
|
|
|
|
export var bar = 1;
|
|
|
|
}
|
|
|
|
interface I16 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: typeof c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I17<T> {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: T;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I18<T, U> {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: U;
|
|
|
|
}
|
|
|
|
//interface I18<T, U extends T> {
|
|
|
|
// [x: string]: any;
|
|
|
|
// foo: U;
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
interface I19 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: Object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface I20 {
|
|
|
|
[x: string]: any;
|
|
|
|
foo: {};
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [subtypesOfAny.js]
|
2014-08-19 19:43:13 +02:00
|
|
|
// every type is a subtype of any, no errors expected
|
2014-07-13 01:04:16 +02:00
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var A2 = (function () {
|
|
|
|
function A2() {
|
|
|
|
}
|
|
|
|
return A2;
|
|
|
|
})();
|
|
|
|
var E;
|
|
|
|
(function (E) {
|
|
|
|
E[E["A"] = 0] = "A";
|
|
|
|
})(E || (E = {}));
|
2015-02-07 03:45:09 +01:00
|
|
|
function f() { }
|
2014-07-13 01:04:16 +02:00
|
|
|
var f;
|
|
|
|
(function (f) {
|
|
|
|
f.bar = 1;
|
|
|
|
})(f || (f = {}));
|
|
|
|
var c = (function () {
|
|
|
|
function c() {
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
})();
|
|
|
|
var c;
|
|
|
|
(function (c) {
|
|
|
|
c.bar = 1;
|
|
|
|
})(c || (c = {}));
|