Replies: 1 comment
-
|
Hi! You have multiple options when it comes to GraphQL type safety in general.
graphql.query<Query, Variables>(...)
// ^^^^^^^^^^^^^^^^
import { GetProductQuery } from '../your-type-gen'
graphql.query(GetProductQuery, resolver)
// ^^^^^^^^^^^^^^^
MSW itself works on fixed types/values provided as either type arguments (1) or generated values that include query/variable types (2). The library does not do any type extraction itself as it's out of its scope. I recommend choosing either of this options depending on your current GraphQL setup. Once you do, the Let me know if you have any other questions! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have a question to extract the variables in the following graphql query.
Example 1:
Query
Variable
Example 2:
Query
Variable
They are working with the same identical response in real graphql endpoint. However, it will be different when extract the variables in msw graphql handler.
How to parse and extract the input varaiable and work in both queries?
Beta Was this translation helpful? Give feedback.
All reactions