fix(types): resolve type discrepancies between ESM and CJS TypeScript…#6956
Merged
jasonsaayman merged 3 commits intoaxios:v1.xfrom Jul 16, 2025
Merged
fix(types): resolve type discrepancies between ESM and CJS TypeScript…#6956jasonsaayman merged 3 commits intoaxios:v1.xfrom
jasonsaayman merged 3 commits intoaxios:v1.xfrom
Conversation
… declaration files
jrnail23
commented
Jul 3, 2025
jrnail23
commented
Jul 3, 2025
jrnail23
commented
Jul 3, 2025
jrnail23
commented
Jul 3, 2025
jrnail23
commented
Jul 3, 2025
jrnail23
commented
Jul 3, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR aligns the CommonJS type definitions in index.d.cts with the ESM definitions by updating signatures and adding missing methods.
- Broaden
AxiosHeaderMatcherto acceptstringorRegExp - Add
getSetCookieonAxiosHeadersand astatic fromfactory onAxiosError - Fix
InternalAxiosRequestConfiggeneric parameter and exposemergeConfig
Comments suppressed due to low confidence (4)
index.d.cts:9
- The new
AxiosHeaderMatchersignature omits theheaders: RawAxiosHeadersparameter from the callback, which may break existing matchers that rely on access to all headers. Consider reintroducing that parameter or updating all downstream usage accordingly.
type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);
index.d.cts:80
- Missing JSDoc comment for
getSetCookie. Add a description explaining what the returned strings represent (e.g., parsedSet-Cookieheader values) and any edge-case behavior.
getSetCookie(): string[];
index.d.cts:102
- No unit tests have been added for the new
AxiosError.fromfactory method. Consider adding tests to verify that it correctly wraps different error inputs and preserves custom properties.
static from<T = unknown, D = any>(
index.d.cts:555
- The
mergeConfigfunction is newly exposed but lacks documentation. Please add JSDoc explaining its merge strategy and sample usage to guide consumers.
mergeConfig<D = any>(config1: AxiosRequestConfig<D>, config2: AxiosRequestConfig<D>): AxiosRequestConfig<D>;
jasonsaayman
previously requested changes
Jul 10, 2025
Member
jasonsaayman
left a comment
There was a problem hiding this comment.
looks good just the swap mentioned as most people do prefer any
Contributor
Author
@jasonsaayman, please see this comment: |
mistakenly mentioned an incorrect type
jasonsaayman
approved these changes
Jul 15, 2025
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #6955
Reconciles type discrepancies between index.d.ts and index.d.cts.