Added and fixed node-cleanup typings.

This commit is contained in:
Martin Donkersloot
2017-08-17 20:45:55 +02:00
parent d6fc15c624
commit 8302e13a9c
5 changed files with 54 additions and 1 deletions

17
types/node-cleanup/index.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for node-cleanup 2.1
// Project: https://github.com/jtlapp/node-cleanup
// Definitions by: Agadar <https://github.com/agadar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Note that ES6 modules cannot directly export callable functions.
// This file should be imported using the CommonJS-style:
// import nodeCleanup = require('node-cleanup');
export = install;
declare function install(cleanupHandler?: ((exitCode: number | null, signal: string | null) => boolean | undefined),
stderrMessages?: { ctrl_C: string; uncaughtException: string }): void;
declare namespace install {
function uninstall(): void;
}

View File

@@ -0,0 +1,13 @@
import nodeCleanup = require('node-cleanup');
function cleanupHandler(exitCode: number | null, signal: string | null): boolean | undefined {
return true;
}
const stderrMessages = { ctrl_C: 'ctrl_c', uncaughtException: 'UncaughtException' };
nodeCleanup();
nodeCleanup(cleanupHandler);
nodeCleanup(cleanupHandler, undefined);
nodeCleanup(cleanupHandler, stderrMessages);
nodeCleanup(undefined, stderrMessages);
nodeCleanup.uninstall();

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-cleanup-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,4 +1,4 @@
// Type definitions for node-telegram-bot-api 0.28.0
// Type definitions for node-telegram-bot-api 0.28
// Project: https://github.com/yagop/node-telegram-bot-api
// Definitions by: Alex Muench <https://github.com/ammuench>
// Agadar <https://github.com/agadar>