question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsc error: Cannot find module 'graphql' or its corresponding type declarations

See original GitHub issue

Prerequisites

Environment check

  • I’m using the latest msw version
  • I’m using Node.js version 14 or higher

Node.js version

v16.11.0

Reproduction repository

https://github.com/takanokana/msw-for-issue

Reproduction steps

1.npm ci 2. npm run typecheck

Current behavior

node_modules/msw/lib/index.d.ts:4:63 - error TS2307: Cannot find module ‘graphql’ or its corresponding type declarations.

4 import { GraphQLError, OperationTypeNode, DocumentNode } from ‘graphql’;

Expected behavior

No errors when executing tsc.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kettanaitocommented, Aug 30, 2022

We’re opening a fix in https://github.com/mswjs/msw/pull/1381. Everyone is welcome to participate in the discussion there.

1reaction
mattcosta7commented, Aug 25, 2022

Hey, @takanokana. Thanks for reporting this.

This issue is tied to the recent discussion around graphql here: #1356. You can find more info about it in the linked pull request.

We’re looking for contributors to fix this. Would you like to help us out?

As a first step, I wonder if a patch release removing the optional peerDependency Meta might be a stopgap (npm should, i believe, install peers automatically - but not 100% sure offhand). From there, most users shouldn’t be warned / see errors.

After that - Separating out the graphql entry might be possible, but not super clear yet

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript: import fail: Cannot find module 'query.gql' #59
Try adding type declaration DocumentNode from graphql typings. // index.d.ts import { DocumentNode } from 'graphql' ...
Read more >
Ask Question - Stack Overflow
How to solve the Error: Cannot find module '../graphql/queries.graphql' or its corresponding type declarations' in an angular project.
Read more >
Cannot find module 'types/graphql' or its corresponding type ...
So I generate a cell in a typescript project and it's complaining Cannot find module 'types/graphql' or its corresponding type declarations.
Read more >
graphql-typescript-definitions - npm
This package will generate matching .d.ts files for each .graphql file you specify. It will generate types in the following format: A default ......
Read more >
cannot find module 'process' or its corresponding type ...
Cannot find name 'process'. Do you need to install type definitions for node? Try npm i --save-dev @types/node and then add node to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found