4.3/5.0 broken on Node.js with Typescript: WebSocket is not defined
WebSocket functionality was introduced in #330 but assumed that WebSocket was available everywhere. This is only the case in the DOM - Node does not have WebSocket available in the global scope. This makes typescript compilation fail in all cases.
Reference comment (cc @SimenB): https://github.com/prisma-labs/graphql-request/pull/330#issuecomment-1239246563
Looks like this breaking change was actually introduced in a minor bump 4.3.
I have the same problem!
node_modules/graphql-request/dist/graphql-ws.d.ts:19:25 - error TS2304: Cannot find name 'WebSocket'.
19 constructor(socket: WebSocket, { onInit, onAcknowledged, onPing, onPong }: SocketHandler); ~~~~~~~~~
Found 1 error(s).
I fixed for now with "skipLibCheck": true In tsconfig.json
same Issue here
node 16
"graphql-request": "^5.0.0",
Yes, this is a problem. We need to be able to use "graphql-request": "^5.0.0" in nodejs without having to include DOM in the ts.config libs
"skipLibCheck": true helped, even though it's not a good way to fix things.
This is still an issue. Bump