Skip to content

feat: improve fetchOptions type definition - #10961

Open
anhlecongtran wants to merge 1 commit into
axios:v1.xfrom
anhlecongtran:fix-fetchoptions-type
Open

feat: improve fetchOptions type definition#10961
anhlecongtran wants to merge 1 commit into
axios:v1.xfrom
anhlecongtran:fix-fetchoptions-type

Conversation

@anhlecongtran

@anhlecongtran anhlecongtran commented May 29, 2026

Copy link
Copy Markdown

This PR addresses issue #6869.

The current fetchOptions type definition includes Record<string, any>, which reduces TypeScript type safety and IDE autocomplete support. This change updates the type definition to rely on RequestInit, which aligns with the Fetch API standard and improves developer experience.

Changes:

  • Removed Record<string, any> from the fetchOptions type definition.
  • Kept the existing RequestInit-based typing.

Related Issue:
#6869


Summary by cubic

Tighten fetchOptions typing to only allow RequestInit fields, removing Record<string, any>. This improves type safety and IDE autocomplete, and may surface invalid option usage at compile time.

Description

Docs

Update /docs/ to state that fetchOptions accepts only RequestInit fields (excluding body, headers, method, signal). Remove any mention of arbitrary custom keys.

Testing

  • No runtime behavior changes.
  • Add or update a small TypeScript type test to ensure only valid RequestInit keys are accepted and invalid keys fail type-check.

Semantic version impact

Breaking (types-only): narrows the public type and can cause new TypeScript errors for consumers passing non-RequestInit fields.

Written for commit 0573372. Summary will update on new commits.

Review in cubic

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

Copy link
Copy Markdown
Contributor

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.

Re-trigger cubic

@jasonsaayman jasonsaayman changed the title Improve fetchOptions type definition feat: improve fetchOptions type definition Jun 17, 2026
@jasonsaayman jasonsaayman self-assigned this Jun 17, 2026
@jasonsaayman jasonsaayman added commit::feat The PR is related to a feature type::breaking The PR introduces breaking changes status::blocked This PR or issue is deemed to be blocked labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::feat The PR is related to a feature status::blocked This PR or issue is deemed to be blocked type::breaking The PR introduces breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants