mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
22 lines
1002 B
Plaintext
22 lines
1002 B
Plaintext
constructorParametersThatShadowExternalNamesInVariableDeclarations.ts(3,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersThatShadowExternalNamesInVariableDeclarations.ts(9,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
|
|
|
|
==== constructorParametersThatShadowExternalNamesInVariableDeclarations.ts (2 errors) ====
|
|
var x = 1;
|
|
class A {
|
|
private a = x;
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
constructor(x: number) {
|
|
}
|
|
}
|
|
|
|
class B {
|
|
private a = x;
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
constructor() {
|
|
var x = "";
|
|
}
|
|
} |