mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
http-graceful-shutdown: Provides its own types (#39597)
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
19cf2b6621
commit
2af5c1a61c
@@ -1590,6 +1590,12 @@
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/html-tags",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "http-graceful-shutdown",
|
||||
"typingsPackageName": "http-graceful-shutdown",
|
||||
"sourceRepoURL": "https://github.com/sebhildebrandt/http-graceful-shutdown",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "http-status",
|
||||
"typingsPackageName": "http-status",
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import GracefulShutdown = require('http-graceful-shutdown');
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
|
||||
const opts: GracefulShutdown.Options = {
|
||||
signals: "SIGINT SIGTERM",
|
||||
timeout: 1337,
|
||||
development: false,
|
||||
onShutdown: (signal) => {
|
||||
console.log('fake shutdown handler', signal);
|
||||
return Promise.resolve();
|
||||
},
|
||||
finally: () => {
|
||||
console.log('fake finally handler');
|
||||
}
|
||||
};
|
||||
|
||||
const httpServer = http.createServer((req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
const httpsServer = https.createServer({
|
||||
key: new Buffer('foo'),
|
||||
cert: new Buffer('bar')
|
||||
}, (req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
GracefulShutdown(httpServer, opts);
|
||||
GracefulShutdown(httpsServer, opts);
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
// Type definitions for http-graceful-shutdown 2.1
|
||||
// Project: https://github.com/sebhildebrandt/http-graceful-shutdown
|
||||
// Definitions by: Dave Lee <https://github.com/dlee-nvisia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Server as HttpServer } from "http";
|
||||
import { Server as HttpsServer } from "https";
|
||||
|
||||
declare function GracefulShutdown(server: HttpServer | HttpsServer, options?: GracefulShutdown.Options): void;
|
||||
|
||||
declare namespace GracefulShutdown {
|
||||
interface Options {
|
||||
signals?: string;
|
||||
timeout?: number;
|
||||
development?: boolean;
|
||||
onShutdown?: (signal: string) => Promise<void>;
|
||||
finally?: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = GracefulShutdown;
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"http-graceful-shutdown-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user