mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
37 lines
2.3 KiB
Plaintext
37 lines
2.3 KiB
Plaintext
constructorParametersInVariableDeclarations.ts(2,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersInVariableDeclarations.ts(3,22): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersInVariableDeclarations.ts(4,23): error TS2301: Initializer of instance member variable 'c' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersInVariableDeclarations.ts(10,17): error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersInVariableDeclarations.ts(11,22): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor.
|
|
constructorParametersInVariableDeclarations.ts(12,23): error TS2301: Initializer of instance member variable 'c' cannot reference identifier 'x' declared in the constructor.
|
|
|
|
|
|
==== constructorParametersInVariableDeclarations.ts (6 errors) ====
|
|
class A {
|
|
private a = x;
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'a' cannot reference identifier 'x' declared in the constructor.
|
|
private b = { p: x };
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor.
|
|
private c = () => x;
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'c' 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.
|
|
private b = { p: x };
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor.
|
|
private c = () => x;
|
|
~
|
|
!!! error TS2301: Initializer of instance member variable 'c' cannot reference identifier 'x' declared in the constructor.
|
|
constructor() {
|
|
var x = 1;
|
|
}
|
|
} |