node_modules/@uchihayuki/js-graphql-client/node_modules/cross-fetch/index.d.ts:3:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: _fetch, _Request, _Response, _Headers, fetch, Request, Response, Headers
3 declare const _fetch: typeof fetch;
~~~~~~~
node_modules/cross-fetch/index.d.ts:3:1
3 declare const _fetch: typeof fetch;
~~~~~~~
Conflicts are in this file.
@uchihayuki/js-graphql-client is written by me, it's a private package. I just found this problem yesterday. I think both of us should remove cross-fetch as a dependency and let the package consumer choose their version, or conflicts will happen. They can include a polyfill.ts in their main index.ts like the following:
import fetch from "cross-fetch";
globalThis.fetch = fetch;
or they can pass the implementation of fetch to your client
import { gql, GraphQLClient } from 'graphql-request';
import fetch from "cross-fetch";
const document = gql`
{
company {
ceo
}
}
`
const endpoint = 'https://api.spacex.land/graphql/'
const client = new GraphQLClient(endpoint, fetch)
await client.request(document)
My point is we shouldn't list that library as dependencies or it will pollute global space.
I haven't read through your code, but does something like the following work for you?
Screenshot
Description
@uchihayuki/js-graphql-client
is written by me, it's a private package. I just found this problem yesterday. I think both of us should removecross-fetch
as a dependency and let the package consumer choose their version, or conflicts will happen. They can include a polyfill.ts in their main index.ts like the following:or they can pass the implementation of fetch to your client
My point is we shouldn't list that library as dependencies or it will pollute global space.
I haven't read through your code, but does something like the following work for you?
Reproduction Steps/Repo Link