Skip to content

fix: correct AxiosInstance call signature for typed responses#7328

Merged
jasonsaayman merged 2 commits intoaxios:v0.xfrom
ivan-churakov:fix/types-axios-instance
Feb 23, 2026
Merged

fix: correct AxiosInstance call signature for typed responses#7328
jasonsaayman merged 2 commits intoaxios:v0.xfrom
ivan-churakov:fix/types-axios-instance

Conversation

@ivan-churakov
Copy link
Copy Markdown

@ivan-churakov ivan-churakov commented Jan 12, 2026

Fixes #7301

What

This PR fixes the AxiosInstance call signature to correctly type the generic response data.

  • The previous type definition allowed incorrect type inference for response data.
  • This change ensures that TypeScript properly enforces the generic type when calling AxiosInstance.
  • No runtime code is affected, only TypeScript definitions.

How to verify

You can verify the fix locally by linking your modified axios package:

1.In your axios fork:

npm link

2.In a separate test project:

npm link axios

3.Write TypeScript code like:

import axios from 'axios';

async function test() {
  const res = await axios<{ foo: string }>('/test');

  res.data.foo; // OK
  res.data.data; // TypeScript error as expected
}

Run TypeScript compilation:

npx tsc --noEmit

@jasonsaayman
Copy link
Copy Markdown
Member

@cubic-dev-ai

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Feb 5, 2026

@cubic-dev-ai

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

@jasonsaayman jasonsaayman self-requested a review February 5, 2026 08:16
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jasonsaayman jasonsaayman added the status::changes-requested A reviewer requested changes to the PR label Feb 14, 2026
@jdpt0
Copy link
Copy Markdown

jdpt0 commented Feb 17, 2026

Hi @jasonsaayman, what changes are needed on this PR? We're hitting this issue and currently stuck on 1.13.2 until this is merged.

@jasonsaayman jasonsaayman removed the status::changes-requested A reviewer requested changes to the PR label Feb 23, 2026
@jasonsaayman
Copy link
Copy Markdown
Member

sorry @jdpt0 i miss labeled im looking at this asap

@jasonsaayman jasonsaayman merged commit 6cbd79b into axios:v0.x Feb 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants