Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect scope checks of class properties (Regression) #14208

Closed
falsandtru opened this issue Feb 21, 2017 · 4 comments
Closed

Incorrect scope checks of class properties (Regression) #14208

falsandtru opened this issue Feb 21, 2017 · 4 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@falsandtru
Copy link
Contributor

TypeScript Version: master

Code

class C {
  constructor() {
    new D().p; // ok
  }
  public p = new D().p; // should also be ok
}
class D {
  public p = '';
}

Expected behavior:

ok

Actual behavior:

$ node built/local/tsc.js index.ts -t es6
index.ts(5,22): error TS2448: Block-scoped variable 'p' used before its declaration.
@falsandtru falsandtru changed the title Incorrect scope checks of class properties Incorrect scope checks of class properties (Regression) Feb 21, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 21, 2017
@mhegazy mhegazy added this to the TypeScript 2.3 milestone Feb 21, 2017
@82antu
Copy link

82antu commented Feb 23, 2017

Typescript 2.2.1, same Issue

@falsandtru
Copy link
Contributor Author

@sandersn Could you fix this?

@sandersn
Copy link
Member

Fix is up at #14952

@sandersn sandersn added the Fixed A PR has been merged for this issue label Mar 31, 2017
@falsandtru
Copy link
Contributor Author

Thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants