Reinforced.Typings
Reinforced.Typings copied to clipboard
Interface inheritance - extend/implement only directly implemented interfaces
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 { }