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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts ===
// undefined is a subtype of every other types, no errors expected below
class Base {
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: typeof undefined;
>foo : Symbol(Base.foo, Decl(undefinedIsSubtypeOfEverything.ts, 2, 12))
>undefined : Symbol(undefined)
}
class D0 extends Base {
>D0 : Symbol(D0, Decl(undefinedIsSubtypeOfEverything.ts, 4, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: any;
>foo : Symbol(D0.foo, Decl(undefinedIsSubtypeOfEverything.ts, 6, 23))
}
class DA extends Base {
>DA : Symbol(DA, Decl(undefinedIsSubtypeOfEverything.ts, 8, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: typeof undefined;
>foo : Symbol(DA.foo, Decl(undefinedIsSubtypeOfEverything.ts, 10, 23))
>undefined : Symbol(undefined)
}
class D1 extends Base {
>D1 : Symbol(D1, Decl(undefinedIsSubtypeOfEverything.ts, 12, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: string;
>foo : Symbol(D1.foo, Decl(undefinedIsSubtypeOfEverything.ts, 14, 23))
}
class D1A extends Base {
>D1A : Symbol(D1A, Decl(undefinedIsSubtypeOfEverything.ts, 16, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: String;
>foo : Symbol(D1A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 18, 24))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class D2 extends Base {
>D2 : Symbol(D2, Decl(undefinedIsSubtypeOfEverything.ts, 20, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: number;
>foo : Symbol(D2.foo, Decl(undefinedIsSubtypeOfEverything.ts, 23, 23))
}
class D2A extends Base {
>D2A : Symbol(D2A, Decl(undefinedIsSubtypeOfEverything.ts, 25, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: Number;
>foo : Symbol(D2A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 27, 24))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class D3 extends Base {
>D3 : Symbol(D3, Decl(undefinedIsSubtypeOfEverything.ts, 29, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: boolean;
>foo : Symbol(D3.foo, Decl(undefinedIsSubtypeOfEverything.ts, 32, 23))
}
class D3A extends Base {
>D3A : Symbol(D3A, Decl(undefinedIsSubtypeOfEverything.ts, 34, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: Boolean;
>foo : Symbol(D3A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 36, 24))
>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class D4 extends Base {
>D4 : Symbol(D4, Decl(undefinedIsSubtypeOfEverything.ts, 38, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: RegExp;
>foo : Symbol(D4.foo, Decl(undefinedIsSubtypeOfEverything.ts, 41, 23))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class D5 extends Base {
>D5 : Symbol(D5, Decl(undefinedIsSubtypeOfEverything.ts, 43, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: Date;
>foo : Symbol(D5.foo, Decl(undefinedIsSubtypeOfEverything.ts, 45, 23))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
}
class D6 extends Base {
>D6 : Symbol(D6, Decl(undefinedIsSubtypeOfEverything.ts, 47, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: number[];
>foo : Symbol(D6.foo, Decl(undefinedIsSubtypeOfEverything.ts, 50, 23))
}
class D7 extends Base {
>D7 : Symbol(D7, Decl(undefinedIsSubtypeOfEverything.ts, 52, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: { bar: number };
>foo : Symbol(D7.foo, Decl(undefinedIsSubtypeOfEverything.ts, 54, 23))
>bar : Symbol(bar, Decl(undefinedIsSubtypeOfEverything.ts, 55, 10))
}
class D8 extends Base {
>D8 : Symbol(D8, Decl(undefinedIsSubtypeOfEverything.ts, 56, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: D7;
>foo : Symbol(D8.foo, Decl(undefinedIsSubtypeOfEverything.ts, 59, 23))
>D7 : Symbol(D7, Decl(undefinedIsSubtypeOfEverything.ts, 52, 1))
}
interface I1 {
>I1 : Symbol(I1, Decl(undefinedIsSubtypeOfEverything.ts, 61, 1))
bar: string;
>bar : Symbol(I1.bar, Decl(undefinedIsSubtypeOfEverything.ts, 63, 14))
}
class D9 extends Base {
>D9 : Symbol(D9, Decl(undefinedIsSubtypeOfEverything.ts, 65, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: I1;
>foo : Symbol(D9.foo, Decl(undefinedIsSubtypeOfEverything.ts, 66, 23))
>I1 : Symbol(I1, Decl(undefinedIsSubtypeOfEverything.ts, 61, 1))
}
class D10 extends Base {
>D10 : Symbol(D10, Decl(undefinedIsSubtypeOfEverything.ts, 68, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: () => number;
>foo : Symbol(D10.foo, Decl(undefinedIsSubtypeOfEverything.ts, 71, 24))
}
enum E { A }
>E : Symbol(E, Decl(undefinedIsSubtypeOfEverything.ts, 73, 1))
>A : Symbol(E.A, Decl(undefinedIsSubtypeOfEverything.ts, 75, 8))
class D11 extends Base {
>D11 : Symbol(D11, Decl(undefinedIsSubtypeOfEverything.ts, 75, 12))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: E;
>foo : Symbol(D11.foo, Decl(undefinedIsSubtypeOfEverything.ts, 76, 24))
>E : Symbol(E, Decl(undefinedIsSubtypeOfEverything.ts, 73, 1))
}
function f() { }
>f : Symbol(f, Decl(undefinedIsSubtypeOfEverything.ts, 78, 1), Decl(undefinedIsSubtypeOfEverything.ts, 80, 16))
module f {
>f : Symbol(f, Decl(undefinedIsSubtypeOfEverything.ts, 78, 1), Decl(undefinedIsSubtypeOfEverything.ts, 80, 16))
export var bar = 1;
>bar : Symbol(bar, Decl(undefinedIsSubtypeOfEverything.ts, 82, 14))
}
class D12 extends Base {
>D12 : Symbol(D12, Decl(undefinedIsSubtypeOfEverything.ts, 83, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: typeof f;
>foo : Symbol(D12.foo, Decl(undefinedIsSubtypeOfEverything.ts, 84, 24))
>f : Symbol(f, Decl(undefinedIsSubtypeOfEverything.ts, 78, 1), Decl(undefinedIsSubtypeOfEverything.ts, 80, 16))
}
class c { baz: string }
>c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23))
>baz : Symbol(c.baz, Decl(undefinedIsSubtypeOfEverything.ts, 89, 9))
module c {
>c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23))
export var bar = 1;
>bar : Symbol(bar, Decl(undefinedIsSubtypeOfEverything.ts, 91, 14))
}
class D13 extends Base {
>D13 : Symbol(D13, Decl(undefinedIsSubtypeOfEverything.ts, 92, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: typeof c;
>foo : Symbol(D13.foo, Decl(undefinedIsSubtypeOfEverything.ts, 93, 24))
>c : Symbol(c, Decl(undefinedIsSubtypeOfEverything.ts, 86, 1), Decl(undefinedIsSubtypeOfEverything.ts, 89, 23))
}
class D14<T> extends Base {
>D14 : Symbol(D14, Decl(undefinedIsSubtypeOfEverything.ts, 95, 1))
>T : Symbol(T, Decl(undefinedIsSubtypeOfEverything.ts, 98, 10))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: T;
>foo : Symbol(D14.foo, Decl(undefinedIsSubtypeOfEverything.ts, 98, 27))
>T : Symbol(T, Decl(undefinedIsSubtypeOfEverything.ts, 98, 10))
}
class D15<T, U> extends Base {
>D15 : Symbol(D15, Decl(undefinedIsSubtypeOfEverything.ts, 100, 1))
>T : Symbol(T, Decl(undefinedIsSubtypeOfEverything.ts, 103, 10))
>U : Symbol(U, Decl(undefinedIsSubtypeOfEverything.ts, 103, 12))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: U;
>foo : Symbol(D15.foo, Decl(undefinedIsSubtypeOfEverything.ts, 103, 30))
>U : Symbol(U, Decl(undefinedIsSubtypeOfEverything.ts, 103, 12))
}
//class D15<T, U extends T> extends Base {
// foo: U;
//}
class D16 extends Base {
>D16 : Symbol(D16, Decl(undefinedIsSubtypeOfEverything.ts, 105, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: Object;
>foo : Symbol(D16.foo, Decl(undefinedIsSubtypeOfEverything.ts, 112, 24))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class D17 extends Base {
>D17 : Symbol(D17, Decl(undefinedIsSubtypeOfEverything.ts, 114, 1))
>Base : Symbol(Base, Decl(undefinedIsSubtypeOfEverything.ts, 0, 0))
foo: {};
>foo : Symbol(D17.foo, Decl(undefinedIsSubtypeOfEverything.ts, 117, 24))
}
|