-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update core helpers to support accurate typing for transformed models #691
Conversation
🦋 Changeset detectedLatest commit: fb1824f The changes in this PR will be included in the next version bump. This PR includes changesets to release 46 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR description and ping. This is a valuable improvement to how I can judge it.
I'm sorry I didn't have the time to add my review before this PR has been merged, but I think this change does not goes in the direction of all the work we're doing in the FE Chapter towards specialized builders instead of general ones which gets transformed. I'm not opposed to this change per se, as it does not conflict with that work, but it won't be necessary in the future. It would be nice for the FE Chapter to be pinged with this kind of changes because of all the deep changes we're working on (reference). |
Hey Carlos, that makes sense. The changes came from a need I had while working on a new feature to resolve some type issues in one of my tests. However, if you believe these changes might cause issues or conflicts in the future, I’m open to reverting them. Let me know |
My concern is about adding more code related to what are not the "legacy" patterns to build data models, but I think it's ok to keep your change. Thanks. |
This is why I approved it.
This is what I saw benefits in.
Agreed let's all inform each other better. |
Description
This PR upgrades type accuracy for list builder helpers by introducing a second type parameter for the transformed output model (either GraphQL or REST).
Previously, only the base model type was specified, representing the model from which the GraphQL or REST representations were derived. As a result, the returned data type did not accurately reflect the transformed output of these representations.
Now, by specifying both the base model type and the transformed output type, the returned data type precisely matches the actual structure of the GraphQL and REST responses.
For backward compatibility, the second type parameter will default to the base model (
Model
) if not provided.Users should now explicitly provide the
GraphqlModel
when needed: