Skip to content

Can't make it work with expo/fetch #2236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
2ico opened this issue Mar 28, 2025 · 1 comment
Open
1 task

Can't make it work with expo/fetch #2236

2ico opened this issue Mar 28, 2025 · 1 comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library

Comments

@2ico
Copy link

2ico commented Mar 28, 2025

openapi-fetch version

0.13.5

Description

I'm not able to use the fetch implementation from expo:
https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api

It seems like the types are incompatible between the global fetch and expo/fetch.
How can this be fixed?

Reproduction

import { fetch as expoFetch } from "expo/fetch"

export const API = createClient<paths>({ 
  baseUrl: API_URL,
  fetch: expoFetch as unknown as typeof globalThis.fetch
})

Expected result

expoFetch should be used as the fetch implementation.

Extra

@2ico 2ico added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels Mar 28, 2025
@2ico
Copy link
Author

2ico commented Mar 29, 2025

For instance, the same approach seems to work with Vercel AI SDK.

https://sdk.vercel.ai/docs/getting-started/expo#wire-up-the-ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

No branches or pull requests

1 participant