node-typescript-parser icon indicating copy to clipboard operation
node-typescript-parser copied to clipboard

feat: inheritance references for classes and interfaces

Open Angelika12 opened this issue 7 years ago • 5 comments

Classes are parsed as ClassDeclarations - anyhow, I don't find the classes, where a specific class inherits from.

Angelika12 avatar Aug 06 '18 12:08 Angelika12

What do you mean by inherits from?

class A {}

class B extends A {}

so the ClassDefinition of B should contain a reference to A ?

buehler avatar Aug 06 '18 13:08 buehler

Yes, exactly. I would need the reference from B to A. The background is that I'm building a programm, which parses a set of Typescript files and generates a class diagramm out of it (for documentation purposes).

Angelika12 avatar Aug 06 '18 13:08 Angelika12

@Angelika12

Ok, so I thought about this and found the following problem: during the parse step, I can only parse the name of the type that a class extends from. I don't have the exact knowledge about the type. This exact reference can only be done when the whole declaration index is used. Then I could parse the name that is used with the given import to actually get the type reference.

buehler avatar Aug 31 '18 07:08 buehler

Ok – thank you for your efforts!

Von: Christoph Bühler [mailto:[email protected]] Gesendet: Freitag, 31. August 2018 09:01 An: buehler/node-typescript-parser [email protected] Cc: Kusel, Angelika [email protected]; Mention [email protected] Betreff: Re: [buehler/node-typescript-parser] feat: inheritance references for classes and interfaces (#88)

@Angelika12https://github.com/Angelika12

Ok, so I thought about this and found the following problem: during the parse step, I can only parse the name of the type that a class extends from. I don't have the exact knowledge about the type. This exact reference can only be done when the whole declaration index is used. Then I could parse the name that is used with the given import to actually get the type reference.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/buehler/node-typescript-parser/issues/88#issuecomment-417571576, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AoLpirpF7yaf5ygI_tFWgWbSVPYxEP7kks5uWN8RgaJpZM4VwSpB.

Angelika12 avatar Aug 31 '18 10:08 Angelika12