Create templates based on the Data and Api type of a widget#889
Merged
agubler merged 5 commits intodojo:masterfrom Mar 22, 2021
Merged
Create templates based on the Data and Api type of a widget#889agubler merged 5 commits intodojo:masterfrom
agubler merged 5 commits intodojo:masterfrom
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1cad718:
|
Codecov Report
@@ Coverage Diff @@
## master #889 +/- ##
==========================================
+ Coverage 94.53% 94.54% +0.01%
==========================================
Files 127 127
Lines 8120 8121 +1
Branches 1895 1896 +1
==========================================
+ Hits 7676 7678 +2
+ Misses 444 443 -1
Continue to review full report at Codecov.
|
matt-gadd
approved these changes
Mar 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Type: feature
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
Widgets can prescribe the the shape of data required for a resource and the API itself. Currently it's really cumbersome to create a template based on the requirements of a resource widget. It requires the user to know the interface of both the data and the API and recreate the typings or import these interfaces/types from somewhere provided by the author. The widget is actually already "stamped" with these types so it would reduce friction significantly to enable users to pass a resource widget to the template factory and the factory infer the data type and resource API.
This is one approach that infers these types based on the generics passed to the
ResourcePropertiesAPI, meaning that all forms of template are supported by passing the a resource widget.Note: To correctly infer all the types for the APIs and the api properties requires an bump the minimum supported version of TypeScript from
3.4.5to3.5.3.