==== tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts (3 errors) ==== // 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. // This effectively means that entities from outer scopes by the same name as a constructor parameter or // local variable are inaccessible in initializer expressions for instance member variables var x = 1; class C { b = x; // error, evaluated in scope of constructor, cannot reference x ~ !!! Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor. constructor(x: string) { x = 2; // error, x is string ~ !!! Type 'number' is not assignable to type 'string'. } } var y = 1; class D { b = y; // error, evaluated in scope of constructor, cannot reference y ~ !!! Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor. constructor(x: string) { var y = ""; } }