You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to type both the request body and the response body.
Example Code
// This code successfully typed the response body but I want to type the request body too.constresult=awaitbackend.post<RawAPIResponse<ResponseData.RegisterResponseData>>(`register`,{
email,
username,
password,});
Expected behavior
I expected something like this but it's not working:
Describe the issue
I'm trying to type both the request body and the response body.
Example Code
Expected behavior
I expected something like this but it's not working:
I did some effort with search engines and found a snippet that actually works:
https://stackoverflow.com/questions/69541197/specify-axios-response-type-on-post-request-with-body
It works but I don't know why and I don't like it. I try to find the documentation about it but didn't find any. There is also a comment mentioned that this is not the "intended" way to use the library, which confuses me even more.
Axios Version
1.7.4
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: