This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
Component: add AbstractComponent to separate Schema-constructable and raw component #251
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.
Hi,
I quickly worked on adding a way to simplify schema-constructable component, as well as their typings.
Why?
Before, constructing a component using its schema was made at runtime, see here.
Separating the schema-constructable component versus raw component directly on the class makes the component a bit more cleaner I believe. From a TypeScript point of view, it also simplifies things as we can now pass a custom
Properties
object forAbstractComponent
(see here), while still being able to keep the previous schema properties type on "normal" component (see here).This PR solves mostly TypeScript issues rather than logic issues. It's really hard to construct component and keep types as safe as possible with the current design.
Improvements
It's highly possible that this design has some issues. If you think it's a good idea to start with we can go this route, and improve it with the community feedback.