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
Is your feature request related to a problem? Please describe.
I strongly sympathize with issue #3313, which was closed by BOT, and feel that it is an issue worth considering, so I will raise another issue with the same content.
Describe the solution you'd like
I think that the type argument of the response should be changed from <T = any> to <T = unknown>.
// <T = any>constasyncFunction=async()=>{constresponse=awaitaxios.get('/path/to/endpoint')constdata=response.data// any 😢constfoo=data.foo// not type error, but foo may be undefined// ...}
// if <T = unknown>constasyncFunction=async()=>{constresponse=awaitaxios.get('/path/to/endpoint')constdata=response.data// unknown// const foo= data.foo // type errorif(hasFoo(data)){// type testing is compulsory 😄 constfoo=data.foo// ...}}
Describe alternatives you've considered
This may be breaking changes, so it might be a good idea to just document the following wrappers.
Is your feature request related to a problem? Please describe.
I strongly sympathize with issue #3313, which was closed by BOT, and feel that it is an issue worth considering, so I will raise another issue with the same content.
Describe the solution you'd like
I think that the type argument of the response should be changed from
<T = any>
to<T = unknown>
.Describe alternatives you've considered
This may be breaking changes, so it might be a good idea to just document the following wrappers.
Additional context
In #3002, @carloschida agrees that
unknown
is optimal choice.The text was updated successfully, but these errors were encountered: