TypeScript Compiler API to access base interfaces or classes

Viewed 89

I working with TypeScript Compiler API on small plugin, and I am curious how to get from NodeObject all interfaces or classes which it extends ?

I have not found useful example in TypeScript Compiler API documentation ...

Any help will be appreciated ...

1 Answers

I have found answer,

It is possible to do using heritageClauses:

if (node.heritageClauses) {
   for(const hc of node.heritageClauses) {
      console.log("heritage clause: " + hc.getText()); // prints "extends ..."
   }
}
Related