Typescript Type guard when query options as a parameter #4565
Unanswered
slamdunkYYY
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a function receiving a parameter
options
then passing down to the RTK query option. I useParameters<typeof usePostQuery>[1]
as the options type, it can verify the options passing to the rtk query.Here is my code:
But with the result type, it gets type any on the
data
. If I don't pass the options, it will get the result data typePost
.How can I define the options type so the RTK Query can still the correct type instead of any?
Beta Was this translation helpful? Give feedback.
All reactions