TypeScript/tests/baselines/reference/implicitAnyWidenToAny.errors.txt

42 lines
1.7 KiB
Plaintext
Raw Normal View History

tests/cases/compiler/implicitAnyWidenToAny.ts(2,5): error TS7005: Variable 'x' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyWidenToAny.ts(3,5): error TS7005: Variable 'x1' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyWidenToAny.ts(4,5): error TS7005: Variable 'widenArray' implicitly has an 'any[]' type.
tests/cases/compiler/implicitAnyWidenToAny.ts(5,5): error TS7005: Variable 'emptyArray' implicitly has an 'any[]' type.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/implicitAnyWidenToAny.ts (4 errors) ====
// these should be errors
var x = null; // error at "x"
~
!!! error TS7005: Variable 'x' implicitly has an 'any' type.
2014-07-13 01:04:16 +02:00
var x1 = undefined; // error at "x1"
~~
!!! error TS7005: Variable 'x1' implicitly has an 'any' type.
2014-07-13 01:04:16 +02:00
var widenArray = [null, undefined]; // error at "widenArray"
~~~~~~~~~~
!!! error TS7005: Variable 'widenArray' implicitly has an 'any[]' type.
2014-07-13 01:04:16 +02:00
var emptyArray = []; // error at "emptyArray"
~~~~~~~~~~
!!! error TS7005: Variable 'emptyArray' implicitly has an 'any[]' type.
2014-07-13 01:04:16 +02:00
// these should not be error
class AnimalObj {
x:any;
}
var foo = 5;
var bar = "Hello World";
var foo1: any = null;
var foo2: any = undefined;
var temp: number = 5;
var c: AnimalObj = { x: null };
var array1 = ["Bob",2];
var array2: any[] = [];
var array3: any[] = [null, undefined];
var array4: number[] = [null, undefined];
var array5 = <any[]>[null, undefined];
var objLit: { new (n: number): any; };
function anyReturnFunc(): any { }
var obj0 = new objLit(1);
var obj1 = anyReturnFunc();