Skip to content

Cannot get symbol inside class decorator (Cannot read property 'members' of un...) #8136

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

Open
mgechev opened this issue Apr 17, 2016 · 3 comments
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@mgechev
Copy link

mgechev commented Apr 17, 2016

TypeScript Version:

1.8.10

Code

@Component({
  selector: SELECTOR
})
class SampleComponent {}
const SELECTOR = 'ng-demo';

Expected behavior:

With sample SyntaxWalker based on tslint, once I visit the PropertyAssignment - selector: SELECTOR and invoke typeChecker.getSymbolAtLocation(prop.initializer); I should get the SELECTOR symbol.

Actual behavior:

     TypeError: Cannot read property 'members' of undefined
      at resolveName (node_modules/typescript/lib/typescript.js:15307:73)
      at resolveEntityName (node_modules/typescript/lib/typescript.js:15725:26)
      at getSymbolOfEntityNameOrPropertyAccessExpression (node_modules/typescript/lib/typescript.js:28708:28)
      at Object.getSymbolAtLocation (node_modules/typescript/lib/typescript.js:28770:28)
@mhegazy
Copy link
Contributor

mhegazy commented Apr 19, 2016

why are you calling it on the initializer? this is the 'ng-demo' part. you probably want PropertyAssignment.name

it shoudl not crash either ways, so that is a bug.

@mhegazy mhegazy added Bug A bug in TypeScript API Relates to the public API for TypeScript labels Apr 19, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Apr 19, 2016

PRs are welcomed

@JoshuaKGoldberg
Copy link
Contributor

Found a root cause. See ☝ linked issues!

@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants