Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface inheritance - extend/implement only directly implemented interfaces #282

Open
zolakt opened this issue Oct 3, 2024 · 0 comments

Comments

@zolakt
Copy link

zolakt commented Oct 3, 2024

I know the title is weird, but I don't know how to describe it better.
Here is a simple example:

This C# code:

public interface A { }

public interface B : A { }

public interface C : B { }

public interface D { }

public class MyClass : C, D { }

Will generate this TS:

export interface A { }

export interface B extends A { }

export interface C extends A, B { } // A is redundant

export interface D { }

export class MyClass implements A, B, C, D { } // A and B are redundant

So when you inherit an interface, it explicitly extends all the interfaces in the tree, instead only the directly extended ones.
Similar when a class implements an interface, it explicitly implements the whole interface tree.

I know it's not a function issue, but it's needless redundancy. I have long inheritance chains, and when I add something in the middle I need to update a whole bunch of classes. Does anyone have an idea how to get rid of the redundancy?

So just to be clear, the output I'm looking for is:

export interface A { }

export interface B extends A { }

export interface C extends B { }

export interface D { }

export class MyClass implements C, D { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@zolakt and others