Cast ws as global.WebSocket (#1978)

This commit is contained in:
Valentin Fernandez
2025-02-17 09:10:28 -05:00
committed by GitHub
parent 0f7954a89b
commit 6197a897aa
+1 -1
View File
@@ -19,4 +19,4 @@ export { packageInfo } from './packageInfo.js';
*/
const isNode22 = typeof process !== 'undefined' && parseInt(process.versions?.node?.split('.')[0] || '0', 10) >= 22;
export const WebSocket = isNode22 ? ws : /*#__PURE__*/ extractGlobal('WebSocket', ws);
export const WebSocket = isNode22 ? (ws as unknown as typeof globalThis.WebSocket) : /*#__PURE__*/ extractGlobal('WebSocket', ws);