fix(typescript-axios): add explicit return type to avoid TS2527 error - #225
Open
dvacca-onfido wants to merge 2 commits into
Open
fix(typescript-axios): add explicit return type to avoid TS2527 error#225dvacca-onfido wants to merge 2 commits into
dvacca-onfido wants to merge 2 commits into
Conversation
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
force-pushed
the
fix/ts2527-axios-unique-symbol
branch
from
August 13, 2026 14:33
66f0b84 to
44a683a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CI fails when building the Node client library with:
Root Cause
axios 1.7.5+ exports a
unique symbolinternally. When TypeScript infers the return type ofcreateRequestFunction, it includes that inaccessible symbol, causing TS2527.Fix
Add an explicit
: Promise<R>return type on the inner arrow function and cast the result withas 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).