ardatan/graphql-import

typescript errors with version 1.0.1

francoisromain opened this issue · 1 comments

Hello,

When I update from version 0.7.1 to 1.0.1, I have the following typesciprt errors:

node_modules/apollo-link-http-common/lib/index.d.ts:4:15 - error TS2304: Cannot find name 'Response'.

4     response: Response;
                ~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:9:15 - error TS2304: Cannot find name 'Response'.

9     response: Response;
                ~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:38:13 - error TS2304: Cannot find name 'WindowOrWorkerGlobalScope'.

38     fetch?: WindowOrWorkerGlobalScope['fetch'];
               ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:54:81 - error TS2304: Cannot find name 'Response'.

54 export declare const parseAndCheckHttpResponse: (operations: any) => (response: Response) => Promise<any>;
                                                                                   ~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:55:54 - error TS2304: Cannot find name 'RequestInfo'.

55 export declare const checkFetcher: (fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>) => void;
                                                        ~~~~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:55:74 - error TS2304: Cannot find name 'RequestInit'.

55 export declare const checkFetcher: (fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>) => void;
                                                                            ~~~~~~~~~~~

node_modules/apollo-link-http-common/lib/index.d.ts:55:98 - error TS2304: Cannot find name 'Response'.

55 export declare const checkFetcher: (fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>) => void;
                                                                                                    ~~~~~~~~

node_modules/graphql-tools-fork/dist/links/createServerHttpLink.d.ts:5:8 - error TS1259: Module '"/node_modules/form-data/index"' can only be default-imported using the 'esModuleInterop' flag

5 import KnownLengthFormData, { AppendOptions } from 'form-data';
         ~~~~~~~~~~~~~~~~~~~

  node_modules/form-data/index.d.ts:10:1
    10 export = FormData;
       ~~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.


Found 8 errors.

Here is how I use importSchema:

import { buildSchema } from 'graphql'
import { importSchema } from 'graphql-import'

const index = importSchema(schemas/index.graphql')

const schema = buildSchema(index)

export default schema

How can I fix these errors?

Than you

Until we fix it, could you change your tsconfig.json's lib field like below;

"lib": ["dom", "esnext"]