Skip to content
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

Typescript Compile fails for 2.2.1 -ERROR #1951

Closed
danielgary opened this issue Nov 12, 2018 · 6 comments
Closed

Typescript Compile fails for 2.2.1 -ERROR #1951

danielgary opened this issue Nov 12, 2018 · 6 comments

Comments

@danielgary
Copy link

When running tsc, the following error occurs.

Definitions of the following identifiers conflict with those in another file: RequestInfo, Headers, HeadersInit, Body, Request, RequestInit, RequestMode, RequestCredentials, RequestCache, RequestRedirect, ReferrerPolicy, Response, ResponseInit, BodyInit, URLSearchParams

@czystyl
Copy link

czystyl commented Nov 12, 2018

I faced the same problem, happens just after importing module:

import { ApolloServer } from 'apollo-server-express';

full error message:

node_modules/apollo-env/lib/global-fetch.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: RequestInfo, Headers, HeadersInit, Body, Request, RequestInit, RequestMode, RequestCredentials, RequestCache, RequestRedirect, ReferrerPolicy, Response, ResponseInit, BodyInit, URLSearchParams

1 declare function fetch(
  ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:25:1
    25 interface Account {
       ~~~~~~~~~
    Conflicts are in this file.

node_modules/typescript/lib/lib.dom.d.ts:25:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: RequestInfo, Headers, HeadersInit, Body, Request, RequestInit, RequestMode, RequestCredentials, RequestCache, RequestRedirect, ReferrerPolicy, Response, ResponseInit, BodyInit, URLSearchParams

25 interface Account {
   ~~~~~~~~~

  node_modules/apollo-env/lib/global-fetch.d.ts:1:1
    1 declare function fetch(
      ~~~~~~~
    Conflicts are in this file.

node_modules/typescript/lib/lib.dom.d.ts:16316:11 - error TS2320: Interface 'Window' cannot simultaneously extend types 'GlobalFetch' and 'WindowOrWorkerGlobalScope'.
  Named property 'fetch' of types 'GlobalFetch' and 'WindowOrWorkerGlobalScope' are not identical.

16316 interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, WindowEventHandlers {
                ~~~~~~

@lemol
Copy link

lemol commented Nov 13, 2018

I solved this issue setting "esModuleInterop": true on tsconfig.json.

Reference: #1189

@juliahw
Copy link

juliahw commented Nov 13, 2018

+1. For me, setting "esModuleInterop": true didn't do anything, but downgrading to 2.2.0 fixed the error.

@ssube
Copy link

ssube commented Dec 4, 2018

Setting "esModuleInterop": true as suggested here, in #1182, and #1189, did not fix the apollo-server/http no default export errors for me either. It did introduce import errors with other modules (which were not fixed by replacing * as imports). My attempted changes are here.

@RockNHawk
Copy link

maybe your project have a sub folder and the sub fodler also has an node_modules folder, delete it may works.

@trevor-scheer
Copy link
Member

Hey @RockNHawk, thank you for trying to be helpful. This issue is closed and about 5 years old, so it's highly unlikely that it's still relevant.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants