Skip to content

Version 1.12.0 made a breaking type change by no longer guaranteeing by relaxing AxiosError.cause? from Error to unknown  #7059

@corneliusroemer

Description

@corneliusroemer

PR #6982 introduced a breaking change to types that seems to not have been noticed by the PR author nor reviewer.

The type signature of AxiosError changed in a non-backwards compatible way:

https://github.com/axios/axios/pull/6982/files#diff-243f86a2e64131743ca04681df5d21438e79fcabe06f18029cb8dcef6a70121fR87-R103

Previously, you guaranteed that if cause is not-null, that it would be an Error, allowing users to do axiosError.cause?.message.

This change makes this code throw a type error when upgrading:

src/services/backendClient.ts:133:70 - error ts(2339): Property 'message' does not exist on type '{}'.

133                 detail: `Failed to make request: ${axiosError.cause?.message}`,
                                                                         ~~~~~~~

(This happened to us in https://github.com/loculus-project/loculus/actions/runs/17924683778/job/50967768780?pr=5071#step:7:76)

It seems that the LLM-generated PR-review message didn't catch that at all and was misleading:

Types: Ensures AxiosError.cause?: unknown and event?: ProgressEvent are present in type definitions.
Type declarations updated to include safe optional fields: cause?: unknown and event?: ProgressEvent.

🧵 Any breaking changes?

No breaking API changes. This preserves backwards-compatible optional behaviors; adapters will still function normally if no err.code or event is present.

This is in fact a non-backwards compatible change.

Originally posted by @corneliusroemer in #6982 (comment)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions