-
Notifications
You must be signed in to change notification settings - Fork 267
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
Better custom cart fragment typing #2440
Labels
Comments
The cart handler came out shortly after we had codegen but its typing was a bit complex and never got proper support. I think it's possible but probably not an easy change in TS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in #2416
Originally posted by theocerutti August 9, 2024
Hello,
When we create a cart with a custom
CART_QUERY_FRAGMENT
it creates an incorrect ts typing.Actually, even with your
DEFAULT_CART_QUERY_FRAGMENT
the typing is not correct.If we have to modify the behavior of the cart it's really annoying since we have to override almost every cart types and that's because of almost one big issue.
So if we create a cart with custom query:
Then theses types:
should be:
Indeed we shouldn't have
Cart
as type but the real queried fragment:CustomCartApiQueryFragment
in this case.also
CartGetProps
should allow to add more custom fields since we could add parameter to cart query fragment:it would be nice to have a dynamic
CartGetProps
: we could "read" the custom query fragment and add variable type dynamically toCartGetProps
.otherwise just add a
extraQueryVariables
prop:The text was updated successfully, but these errors were encountered: