-
Notifications
You must be signed in to change notification settings - Fork 249
Closed
Labels
Description
Let's assume I'm extending a class from a library, and I'm interested only in exporting exactly the extensions of my class to typescript because there is already a typescript typing for the library classes. How is this possible?
Scenario:
public class MyExtension extends LibraryClassA {
private String myString;
// some inherited fields from LibraryClassA
}
-> This should turn into something like:
declare namespace mynamespace {
interface MyExtension extends LibraryClassA {
myString: string;
// no inherited fields, since they are already in the extended interface.
}
}
Is there a way for this? Is this a common use-case? Should I go for this or not?
The reason why I'm asking: the LibraryClassA has like 20 attributes, and I cannot change the LibraryClassA... And I don't want to create my variables in typescript like:
const myExtensionInstance: mynamespace.MyExtension = {
myString: 'hello world',
inheritedField1: null,
inheritedField2: null,
inheritedField3: null,
inheritedField4: null,
inheritedField5: null,
// ... <- set all inherited fields to null
}