I currently work with two applications that share the same code base for their models.
I am interested in developing and sharing a library model using inheritance in TypeScript.
For instance, Pet extends Author
.
In my current Angular application, I need to include some prototypal functions that are specific to the application domain in both the Pet and Author classes.
For example:
pet.extension file
Pet.prototype['fetchUrl']
author.extension file
Author.prototype['follow']
So, I create a file called pet.extension
which imports the pet.class
, where I add domain-specific methods, then export and utilize these extended classes.
When creating a new instance, I import this extension without any issues. My Pet class now has additional prototypal methods. However, this overloaded class relies on pet.class
and pet.class extends author.class
, not author.extension
.
Is there a way to create and use an overloaded version of the Author class?
The ultimate goal is to mimic the extensions feature in Swift language within my library while maintaining the OOP structure.
I hope this explanation is clear :)
Thank you for your assistance!