This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
Eliminates ProxyAdmin code duplication in ProxyAdminProject and AppProject using TypeScript Mixins #815
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of the PR is to eliminate code duplication at ProxyAdminProject and AppProject classes as well as introduce and showcase TypeScript Mixins usage in the project.
Notes on TypeScript Mixins
TypeScripts Mixins is a relatively new feature with no official or community consensus on usage or established library. It is under development and presents certain challenges. Mixins are great for development but should be used with caution. Official documentation is outdated but there is PR introducing a new approach.
Regarding ZOS I struggled with mixin abstract classes. Generally speaking it is not possible to mixin abstract classes in TypeScript at that moment. There are some workarounds but will probably cause a loss of compile type checks which defeats the entire purpose of using TypeScript. I believe in the long term we should replace abstract classes & inheritance with mixins.
Another issue is mixins constrain for constructor signature
constructor(...args: any[])
. That doesn't allow mixins to type their constructor parameters and forced to use a workaround in order for mixins to access their constructor arguments.Despite all current struggles I believe using Mixins in a typed way clearly outweighs limitations of inheritance and abstract classes. As TypeScript language support for Mixins will improve over the time we should rely more on them at ZOS.