Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: node_modules/@types/ws/index.d.ts:328:18 - error TS2315: Type 'Server' is not generic. #6303

Closed
Muhammad-Altabba opened this issue Jul 24, 2023 · 0 comments · Fixed by #6309
Assignees
Labels
4.x 4.0 related Bug Addressing a bug Discussion

Comments

@Muhammad-Altabba
Copy link
Contributor

Muhammad-Altabba commented Jul 24, 2023

The package web3-providers-ws uses "@types/ws": "^8.5.3". But a breaking change was introduced in @types/ws version 8.5.5. So, when the user adds the last version of web3.js, the version 8.5.5 is installed. And the following error comes:

Error: node_modules/@types/ws/index.d.ts:328:18 - error TS2315: Type 'Server' is not generic.

328         server?: HTTPServer<V> | HTTPSServer<V> | undefined;
                     ~~~~~~~~~~~~~


Error: node_modules/@types/ws/index.d.ts:328:34 - error TS2315: Type 'Server' is not generic.

328         server?: HTTPServer<V> | HTTPSServer<V> | undefined;
                                     ~~~~~~~~~~~~~~

For more check: DefinitelyTyped/DefinitelyTyped#65849 and
DefinitelyTyped/DefinitelyTyped#65501.

Suggested Solution

At the package web3-providers-ws, use "@types/ws": "8.5.3" instead of "@types/ws": "^8.5.3" and move it to devDependencies.

Quick Fix

At the project that uses web3.js, try Using the following at package.json:

"overrides": {
  "web3-providers-ws": {
    "@types/ws": "8.5.4"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug Discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants