TypeScript/tests/baselines/reference/implicitAnyWidenToAny.errors.txt
2014-09-12 13:35:07 -07:00

42 lines
1.7 KiB
Plaintext

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.
==== 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.
var x1 = undefined; // error at "x1"
~~
!!! error TS7005: Variable 'x1' implicitly has an 'any' type.
var widenArray = [null, undefined]; // error at "widenArray"
~~~~~~~~~~
!!! error TS7005: Variable 'widenArray' implicitly has an 'any[]' type.
var emptyArray = []; // error at "emptyArray"
~~~~~~~~~~
!!! error TS7005: Variable 'emptyArray' implicitly has an 'any[]' type.
// 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();