Skip to content

fix(typescript-axios): add explicit return type to avoid TS2527 error - #225

Open
dvacca-onfido wants to merge 2 commits into
masterfrom
fix/ts2527-axios-unique-symbol
Open

fix(typescript-axios): add explicit return type to avoid TS2527 error#225
dvacca-onfido wants to merge 2 commits into
masterfrom
fix/ts2527-axios-unique-symbol

Conversation

@dvacca-onfido

@dvacca-onfido dvacca-onfido commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

CI fails when building the Node client library with:

common.ts(109,14): error TS2527: The inferred type of 'createRequestFunction' references an inaccessible 'unique symbol' type. A type annotation is necessary.

Root Cause

axios 1.7.5+ exports a unique symbol internally. When TypeScript infers the return type of createRequestFunction, it includes that inaccessible symbol, causing TS2527.

Fix

Add an explicit : Promise<R> return type on the inner arrow function and cast the result with as Promise<R>, preventing TypeScript from exposing the inaccessible symbol in the inferred type.

This matches the upstream openapi-generator fix: OpenAPITools/openapi-generator#24526 (not yet included in v7.16.0).

dvacca-onfido and others added 2 commits August 13, 2026 16:31
axios 1.7.5+ exports a unique symbol that TypeScript cannot infer
through the generated createRequestFunction. Adding an explicit
': Promise<R>' return type on the inner arrow function and casting the
result prevents TS from exposing the inaccessible symbol.

Upstream fix: OpenAPITools/openapi-generator#24526 (not yet in v7.16.0).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dvacca-onfido
dvacca-onfido force-pushed the fix/ts2527-axios-unique-symbol branch from 66f0b84 to 44a683a Compare August 13, 2026 14:33
@dvacca-onfido dvacca-onfido changed the title fix(typescript-axios): resolve TS2527 inaccessible unique symbol error fix(typescript-axios): add explicit return type to avoid TS2527 error Aug 13, 2026
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