DefinitelyTyped/types/stoppable/stoppable-tests.ts
John Plusje e3c335e16e Add call to server.close() in order to show that http.Server is properly extended.
Added a StoppableServer type for typing the created server instance.
2018-11-26 19:48:57 +01:00

13 lines
390 B
TypeScript

import * as http from 'http';
import stoppable = require('stoppable');
const server: stoppable.StoppableServer = stoppable(http.createServer());
server.stop();
const server2: stoppable.StoppableServer = stoppable(http.createServer(), 10000);
server2.stop();
const server3: stoppable.StoppableServer = stoppable(http.createServer());
server.stop((err, gracefully) => {});
server.close();