From 8302e13a9ce7c8e052aa1e4febd5c215440ac09b Mon Sep 17 00:00:00 2001 From: Martin Donkersloot Date: Thu, 17 Aug 2017 20:45:55 +0200 Subject: [PATCH] Added and fixed node-cleanup typings. --- types/node-cleanup/index.d.ts | 17 +++++++++++++++++ types/node-cleanup/node-cleanup-tests.ts | 13 +++++++++++++ types/node-cleanup/tsconfig.json | 22 ++++++++++++++++++++++ types/node-cleanup/tslint.json | 1 + types/node-telegram-bot-api/index.d.ts | 2 +- 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 types/node-cleanup/index.d.ts create mode 100644 types/node-cleanup/node-cleanup-tests.ts create mode 100644 types/node-cleanup/tsconfig.json create mode 100644 types/node-cleanup/tslint.json diff --git a/types/node-cleanup/index.d.ts b/types/node-cleanup/index.d.ts new file mode 100644 index 0000000000..103f0bc813 --- /dev/null +++ b/types/node-cleanup/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for node-cleanup 2.1 +// Project: https://github.com/jtlapp/node-cleanup +// Definitions by: 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; +} diff --git a/types/node-cleanup/node-cleanup-tests.ts b/types/node-cleanup/node-cleanup-tests.ts new file mode 100644 index 0000000000..ec42821dff --- /dev/null +++ b/types/node-cleanup/node-cleanup-tests.ts @@ -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(); diff --git a/types/node-cleanup/tsconfig.json b/types/node-cleanup/tsconfig.json new file mode 100644 index 0000000000..c05b3b90bf --- /dev/null +++ b/types/node-cleanup/tsconfig.json @@ -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" + ] +} diff --git a/types/node-cleanup/tslint.json b/types/node-cleanup/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-cleanup/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/node-telegram-bot-api/index.d.ts b/types/node-telegram-bot-api/index.d.ts index 2b67bac385..60b46b137c 100644 --- a/types/node-telegram-bot-api/index.d.ts +++ b/types/node-telegram-bot-api/index.d.ts @@ -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 // Agadar