I need to add functionality to existing Node.js class, specifically Server
. Is it possible to use something along the lines of the following snippet?
import * as net from 'net'
type ShutdownableServer = net.Server & { shutdown(): Promise<void> }
function withShutdown(server: net.Server): ShutdownableServer {
/* ... */
}