feat(types): Allow the Params property to be typed, instead of any - #11081
jasonsaayman merged 14 commits into
Conversation
Co-authored-by: willen leal <willenlealdev@gmail.com> Resubmission of 499c9fc
any
|
thanks @shaedrich i will be adding to the pr and then merging. we are now trying to get through pr's etc much faster than before |
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
@jasonsaayman Thanks, appreciate it! |
There was a problem hiding this comment.
All reported issues were addressed across 14 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
@cubic-dev-ai please review in depth again |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Note
If you, due to time constraints or otherwise, won't be able to review this PR within the next year, please just say so right away and save us all time and nerves. Thanks in advance.
Similar to/Follow-up to #1061
Resubmission of #6807
Summary
Currently, it is not possible to have
AxiosRequestConfig.paramscorrectly typed—it will always beany. This PR changes that.Linked issue
Closes #4954
Changes
AxiosRequestConfig.paramsgeneric, so it can be typed/the type be inferredChecklist
index.d.tsandindex.d.cts)Summary by cubic
Adds a
paramsgeneric toaxiosrequest configs and propagates it across the public types for stronger typing and inference, with no runtime changes. Default request methods andAxiosPromisenow preserve the request data and params types onresponse.config.Description
PtoAxiosRequestConfig<D = any, P = any>and propagated toRawAxiosRequestConfig,InternalAxiosRequestConfig,AxiosDefaults,CreateAxiosDefaults,AxiosResponse<T, D, H, P>,AxiosError<T, D, P>,CanceledError<T, D, P>,isCancel<T, D, P>(),isAxiosError<T, D, P>(), all request aliases and callableAxiosInstance, adapters,AxiosPromise<T, D, P>, andmergeConfig<D, P>()in both ESM (index.d.ts) and CJS (index.d.cts).AxiosResponseDefaultto keep existing generic positions; defaulted request aliases now returnAxiosResponse<T, D, {}, P>soresponse.config.dataandresponse.config.paramsmirror the request types.CustomParamsSerializer<P>andParamsSerializerOptions<P>generic and tied to the requestparamstype;withXSRFTokencallback now receivesInternalAxiosRequestConfig<D, P>.P = any.AxiosRequestConfig<MyData, MyParams>or method aliases with trailingP, e.g.axios.get<T, R, D, P>(...).Docs
AxiosRequestConfig<D, P>, genericCustomParamsSerializer<P>/ParamsSerializerOptions<P>, propagation toInternalAxiosRequestConfig,AxiosResponse,AxiosPromise<T, D, P>,AxiosError,CanceledError,isCancel, request aliases/callable instances, adapters, andmergeConfig<D, P>().params, a serializer receivingP, and defaulted alias/AxiosPromiseresponses preservingresponse.config.data/params; noteP = anydefault and unchanged generic order.Testing
paramsand serializers useP.InternalAxiosRequestConfig,AxiosResponse.config,AxiosError.config, andisCancelnarrowing.AxiosPromise<T, D, P>, andmergeConfigpreserveDandP.Semantic version impact
Minor: additive typing changes with
P = anydefault; no runtime changes.Written for commit 5a0d082. Summary will update on new commits.