TypeScript/tests/baselines/reference/duplicateVariablesWithAny.errors.txt
2014-07-12 17:30:19 -07:00

26 lines
964 B
Plaintext

==== tests/cases/compiler/duplicateVariablesWithAny.ts (4 errors) ====
// They should have to be the same even when one of the types is 'any'
var x: any;
var x = 2; //error
~
!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
var y = "";
var y; //error
~
!!! Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
module N {
var x: any;
var x = 2; //error
~
!!! Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
var y = "";
var y; //error
~
!!! Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'.
}
var z: any;
var z; // ok