2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/constructorParametersThatShadowExternalNamesInVariableDeclarations.ts (2 errors) ====
|
|
|
|
var x = 1;
|
|
|
|
class A {
|
|
|
|
private a = x;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
2014-07-13 01:04:16 +02:00
|
|
|
constructor(x: number) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class B {
|
|
|
|
private a = x;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
2014-07-13 01:04:16 +02:00
|
|
|
constructor() {
|
|
|
|
var x = "";
|
|
|
|
}
|
|
|
|
}
|