fix(test): add @types/ws and fix type cast for WebSocket polyfill

This commit is contained in:
Claude
2026-01-07 10:08:45 +00:00
parent 04136f79fc
commit 82680e6b99
3 changed files with 13 additions and 2 deletions

11
package-lock.json generated
View File

@@ -73,6 +73,7 @@
"@types/react-dom": "^19.2.3",
"@types/shell-quote": "^1.7.5",
"@types/uuid": "^10.0.0",
"@types/ws": "^8.18.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/ui": "^4.0.15",
"autoprefixer": "^10.4.20",
@@ -4389,6 +4390,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/ws": {
"version": "8.18.1",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.48.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.0.tgz",

View File

@@ -81,6 +81,7 @@
"@types/react-dom": "^19.2.3",
"@types/shell-quote": "^1.7.5",
"@types/uuid": "^10.0.0",
"@types/ws": "^8.18.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/ui": "^4.0.15",
"autoprefixer": "^10.4.20",

View File

@@ -9,5 +9,4 @@ import "fake-indexeddb/auto";
// Polyfill WebSocket - required by nostr-tools relay code
import { WebSocket } from "ws";
// @ts-expect-error - polyfilling global WebSocket for Node.js
globalThis.WebSocket = WebSocket;
globalThis.WebSocket = WebSocket as unknown as typeof globalThis.WebSocket;