Microsoft/TypeScript

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

开放

#8,136 创建于 2016年4月17日

 (3 条评论) (0 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
BugDomain: APIDomain: DecoratorsHelp Wanted

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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)

贡献者指南