【发布时间】:2020-07-31 08:34:56
【问题描述】:
我在小插件上使用TypeScript Compiler API,
我很好奇如何从NodeObject 获取它扩展的所有接口或类?
我在TypeScript Compiler API 文档中没有找到有用的示例...
任何帮助将不胜感激...
【问题讨论】:
标签: typescript typescript-compiler-api
我在小插件上使用TypeScript Compiler API,
我很好奇如何从NodeObject 获取它扩展的所有接口或类?
我在TypeScript Compiler API 文档中没有找到有用的示例...
任何帮助将不胜感激...
【问题讨论】:
标签: typescript typescript-compiler-api
我已经找到答案了,
可以使用heritageClauses:
if (node.heritageClauses) {
for(const hc of node.heritageClauses) {
console.log("heritage clause: " + hc.getText()); // prints "extends ..."
}
}
【讨论】: