In index.d.ts
function createServer(opts?: WebSocket.ServerOptions, callback?: () => void): Server;
Should become
function createServer(opts?: WebSocket.ServerOptions, callback?: (socket: WebSocketDuplex) => void): Server;
Since the callback is missing the parameter, typescript isn't allowing to pass a handler function