ardatan / ardatan/graphql-import

typescript errors with version 1.0.1

Open
#537 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
864
Forks
53
PR merge metrics
No merged PRs in 30d

Description

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;
~~~~~~~~

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) => 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) => 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) => 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`:

```js
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the TypeScript compilation errors from the reported importSchema usage. Inspect the declarations in node_modules/apollo-link-http-common/lib/index.d.ts, node_modules/graphql-tools-fork/dist/links/createServerHttpLink.d.ts, and node_modules/form-data/index.d.ts to identify the dependency or compiler-configuration mismatch. Done means the reported eight errors no longer occur with graphql-import 1.0.1.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.