Microsoft/TypeScript

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

Open

#8,136 建立於 2016年4月17日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)TypeScript (48,455 star) (6,726 fork)batch import
BugDomain: APIDomain: DecoratorsHelp Wanted

描述

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)

貢獻者指南