-
-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.17.0
Plugin version
8.0.0
Node.js version
16.20.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Pop!_OS 22.04
Description
The problem is in the d.ts file. The WebSocket is imported as import * as WebSocket from 'ws', but ws has 2 different d.ts files: the regular one and .mts one, the regular one has a single export export = WebSocket, but the .mts one exports functions, types and the WebSocket itself, resulting in type WebSocket = /*unresolved*/ any.
I haven't seen this problem using "moduleResolution": "node".
Just by changing import * as WebSocket from 'ws' to import WebSocket from 'ws' the problem resolves. If that's okay i can PR fixes.
Steps to Reproduce
- Clone repository
- Run
pnpm install - See no error at line 10 in
index.ts - Change
moduleResolutiontonodeintsconfig.json - See an error at line 10 in
index.ts - Change
moduleResolutiontobundlerintsconfig.json - Change
import * as WebSocket from 'ws'toimport WebSocket from 'ws'in the d.ts file - See an error at line 10 in
index.ts
Expected Behavior
The WebSocket type doesn't resolve to /*unresolved*/ any using ESM and moduleResolution: "bundler".
Metadata
Metadata
Assignees
Labels
No labels
