Skip to content

fix(types): reference axios-retry where its augmentation is used - #8

Open
MaxAdams98 wants to merge 1 commit into
boycce:masterfrom
MaxAdams98:fix/axios-retry-type-reference
Open

MaxAdams98 wants to merge 1 commit into
boycce:masterfrom
MaxAdams98:fix/axios-retry-type-reference

Conversation

@MaxAdams98

Copy link
Copy Markdown

packages/core/client/app.tsx:312 passes an 'axios-retry' key in an axios request config:

storeData = (await axios().get('/api/store', { 'axios-retry': { retries: 3 }, timeout: 4000 })).data

That key only exists through axios-retry's module augmentation of AxiosRequestConfig, and an augmentation applies only where the package is referenced. Nothing referenced it, so any project that typechecks this file gets:

node_modules/nitro-web/client/app.tsx(312,54): error TS2353: Object literal may only
specify known properties, and ''axios-retry'' does not exist in type 'AxiosRequestConfig<any, any>'.

axios-retry is already a dependency (^3.3.1), so this is purely the missing reference — no dependency change.

Verified in a consumer

On a project using 0.3.15, with its own workaround removed:

before:  node_modules/nitro-web/client/app.tsx(312,54): error TS2353 ...
after:   axios-retry errors: 0

The reference is in app.tsx rather than a .d.ts so it travels with the file to consumers, and because types/ is generated by the types script and would be overwritten.

Why it is worth fixing upstream

Consumers currently each carry their own reference, or filter the line out of their typecheck. A second project I compared notes with had been reading past this error long enough that it became background noise — which is how an unrelated bug (#5) survived unnoticed in their output. Adding the reference here took them to a clean typecheck.

🤖 Generated with Claude Code

client/app.tsx passes an 'axios-retry' key in an axios request config. That key
exists only through axios-retry's module augmentation, which applies where the
package is referenced — and nothing referenced it, so any project typechecking
this file errored on it.

axios-retry is already a dependency, so this is purely the missing reference.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant