Denis Kotov
Denis Kotov

Reputation: 882

TypeScript Compiler API to access base interfaces or classes

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 ...

Upvotes: 3

Views: 380

Answers (1)

Denis Kotov
Denis Kotov

Reputation: 882

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 ..."
   }
}

Upvotes: 1

Related Questions