26 lines
No EOL
964 B
Text
26 lines
No EOL
964 B
Text
==== 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 |