Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 480
Denis Kotov Avatar asked Sep 16 '26 01:09

Denis Kotov


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 ..."
   }
}
like image 62
Denis Kotov Avatar answered Sep 18 '26 17:09

Denis Kotov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!