I am trying to extend the following WebSocket https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ws/index.d.ts
Whatever I try, I cannot seem to add a new property to the WebSocket
// Messes with other typings in the WebSocket
declare module "ws" {
// Tried declare class MyWebSocket extends WebSocket too
interface WebSocket {
id: string;
}
}
wss.on("connection", socket => {
const id = uuidv4();
socket.id = id
socket.on("message", data => {
I saw multiple people having this issue online but I could not find a detailed solution