mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 11:42:13 +03:00
21 lines
519 B
TypeScript
21 lines
519 B
TypeScript
// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor.
|
|
|
|
class C {
|
|
a = z; // error
|
|
b: typeof z; // error
|
|
c = this.z; // error
|
|
d: typeof this.z; // error
|
|
constructor(x) {
|
|
z = 1;
|
|
}
|
|
}
|
|
|
|
class D<T> {
|
|
a = z; // error
|
|
b: typeof z; // error
|
|
c = this.z; // error
|
|
d: typeof this.z; // error
|
|
constructor(x: T) {
|
|
z = 1;
|
|
}
|
|
} |