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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
|
tests/cases/compiler/intTypeCheck.ts(35,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required.
tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Object' is not assignable to type 'i1'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'p' is missing in type 'Object'.
tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not assignable to type 'i1'.
Property 'p' is missing in type 'Base'.
tests/cases/compiler/intTypeCheck.ts(103,5): error TS2322: Type '() => void' is not assignable to type 'i1'.
Property 'p' is missing in type '() => void'.
tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'.
tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(106,21): error TS2693: 'i1' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
Type '{}' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Type 'Object' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
Type 'Base' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2693: 'i2' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
Type '{}' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Type 'Object' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
Type 'Base' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
Type '() => void' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2693: 'i3' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(148,22): error TS2693: 'i4' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{}' is not assignable to type 'i5'.
Property 'p' is missing in type '{}'.
tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Object' is not assignable to type 'i5'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'p' is missing in type 'Object'.
tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not assignable to type 'i5'.
Property 'p' is missing in type 'Base'.
tests/cases/compiler/intTypeCheck.ts(159,5): error TS2322: Type '() => void' is not assignable to type 'i5'.
Property 'p' is missing in type '() => void'.
tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'.
tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(162,22): error TS2693: 'i5' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
Type '{}' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Type 'Object' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
Type 'Base' provides no match for the signature '(): any'
tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
Type 'void' is not assignable to type 'number'.
tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2693: 'i6' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
Type '{}' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Type 'Object' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'.
Type 'Base' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
Type '() => void' provides no match for the signature 'new (): any'
tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2693: 'i7' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(204,22): error TS2693: 'i8' only refers to a type, but is being used as a value here.
tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
==== tests/cases/compiler/intTypeCheck.ts (63 errors) ====
interface i1 {
//Property Signatures
p;
p1?;
p2?: string;
p3();
p4? ();
p5? (): void;
p6(pa1): void;
p7? (pa1, pa2): void;
}
interface i2 {
//Call Signatures
();
(): number;
(p);
(p1: string);
(p2?: string);
(...p3: any[]);
(p4: string, p5?: string);
(p6: string, ...p7: any[]);
}
interface i3 {
//Construct Signatures
new ();
new (): number;
new (p: string);
new (p2?: string);
new (...p3: any[]);
new (p4: string, p5?: string);
new (p6: string, ...p7: any[]);
}
interface i4 {
// Used to be indexer, now it is a computed property
[p];
~
!!! error TS2304: Cannot find name 'p'.
//Index Signatures
[p1: string];
[p2: string, p3: number];
}
interface i5 extends i1 { }
interface i6 extends i2 { }
interface i7 extends i3 { }
interface i8 extends i4 { }
interface i9 { }
class Base { foo() { } }
interface i11 {
//Call Signatures
();
(): number;
(p);
(p1: string);
(p2?: string);
(...p3: any[]);
(p4: string, p5?: string);
(p6: string, ...p7: any[]);
//(p8?: string, ...p9: any[]);
//(p10:string, p8?: string, ...p9: any[]);
//Construct Signatures
new ();
new (): number;
new (p: string);
new (p2?: string);
new (...p3: any[]);
new (p4: string, p5?: string);
new (p6: string, ...p7: any[]);
// Used to be indexer, now it is a computed property
[p];
~
!!! error TS2304: Cannot find name 'p'.
//Index Signatures
[p1: string];
[p2: string, p3: number];
//Property Signatures
p;
p1?;
p2?: string;
p3();
p4? ();
p5? (): void;
p6(pa1): void;
p7(pa1, pa2): void;
p7? (pa1, pa2): void;
~~
!!! error TS2386: Overload signatures must all be optional or required.
}
var anyVar: any;
//
// Property signatures
//
var obj0: i1;
var obj1: i1 = {
p: null,
p3: function ():any { return 0; },
p6: function (pa1):any { return 0; },
p7: function (pa1, pa2):any { return 0; }
};
var obj2: i1 = new Object();
~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i1'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Property 'p' is missing in type 'Object'.
var obj3: i1 = new obj0;
~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var obj4: i1 = new Base;
~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i1'.
!!! error TS2322: Property 'p' is missing in type 'Base'.
var obj5: i1 = null;
var obj6: i1 = function () { };
~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i1'.
!!! error TS2322: Property 'p' is missing in type '() => void'.
//var obj7: i1 = function foo() { };
var obj8: i1 = <i1> anyVar;
var obj9: i1 = new <i1> anyVar;
~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i1'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i1' only refers to a type, but is being used as a value here.
var obj10: i1 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Call signatures
//
var obj11: i2;
var obj12: i2 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i2'.
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
var obj13: i2 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i2'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
var obj14: i2 = new obj11;
~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var obj15: i2 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i2'.
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
var obj16: i2 = null;
var obj17: i2 = function ():any { return 0; };
//var obj18: i2 = function foo() { };
var obj19: i2 = <i2> anyVar;
var obj20: i2 = new <i2> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i2'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i2' only refers to a type, but is being used as a value here.
var obj21: i2 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Construct Signatures
//
var obj22: i3;
var obj23: i3 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i3'.
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
var obj24: i3 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i3'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
var obj25: i3 = new obj22;
var obj26: i3 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i3'.
!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any'
var obj27: i3 = null;
var obj28: i3 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i3'.
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
//var obj29: i3 = function foo() { };
var obj30: i3 = <i3> anyVar;
var obj31: i3 = new <i3> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i3'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i3' only refers to a type, but is being used as a value here.
var obj32: i3 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Index Signatures
//
var obj33: i4;
var obj34: i4 = {};
var obj35: i4 = new Object();
var obj36: i4 = new obj33;
~~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var obj37: i4 = new Base;
var obj38: i4 = null;
var obj39: i4 = function () { };
//var obj40: i4 = function foo() { };
var obj41: i4 = <i4> anyVar;
var obj42: i4 = new <i4> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i4'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i4' only refers to a type, but is being used as a value here.
var obj43: i4 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Interface Derived I1
//
var obj44: i5;
var obj45: i5 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i5'.
!!! error TS2322: Property 'p' is missing in type '{}'.
var obj46: i5 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i5'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Property 'p' is missing in type 'Object'.
var obj47: i5 = new obj44;
~~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var obj48: i5 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i5'.
!!! error TS2322: Property 'p' is missing in type 'Base'.
var obj49: i5 = null;
var obj50: i5 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i5'.
!!! error TS2322: Property 'p' is missing in type '() => void'.
//var obj51: i5 = function foo() { };
var obj52: i5 = <i5> anyVar;
var obj53: i5 = new <i5> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i5'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i5' only refers to a type, but is being used as a value here.
var obj54: i5 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Interface Derived I2
//
var obj55: i6;
var obj56: i6 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i6'.
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
var obj57: i6 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i6'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
var obj58: i6 = new obj55;
~~~~~~~~~
!!! error TS2350: Only a void function can be called with the 'new' keyword.
var obj59: i6 = new Base;
~~~~~
!!! error TS2322: Type 'Base' is not assignable to type 'i6'.
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
var obj60: i6 = null;
var obj61: i6 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i6'.
!!! error TS2322: Type 'void' is not assignable to type 'number'.
//var obj62: i6 = function foo() { };
var obj63: i6 = <i6> anyVar;
var obj64: i6 = new <i6> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i6'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i6' only refers to a type, but is being used as a value here.
var obj65: i6 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Interface Derived I3
//
var obj66: i7;
var obj67: i7 = {};
~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'i7'.
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
var obj68: i7 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i7'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
var obj69: i7 = new obj66;
var obj70: i7 = <i7>new Base;
~~~~~~~~~~~~
!!! error TS2352: Type 'Base' cannot be converted to type 'i7'.
!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any'
var obj71: i7 = null;
var obj72: i7 = function () { };
~~~~~
!!! error TS2322: Type '() => void' is not assignable to type 'i7'.
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
//var obj73: i7 = function foo() { };
var obj74: i7 = <i7> anyVar;
var obj75: i7 = new <i7> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i7'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i7' only refers to a type, but is being used as a value here.
var obj76: i7 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
//
// Interface Derived I4
//
var obj77: i8;
var obj78: i8 = {};
var obj79: i8 = new Object();
var obj80: i8 = new obj77;
~~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var obj81: i8 = new Base;
var obj82: i8 = null;
var obj83: i8 = function () { };
//var obj84: i8 = function foo() { };
var obj85: i8 = <i8> anyVar;
var obj86: i8 = new <i8> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i8'.
~
!!! error TS1109: Expression expected.
~~
!!! error TS2693: 'i8' only refers to a type, but is being used as a value here.
var obj87: i8 = new {};
~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|