From dee38ca92047860f8e7848d290d55c7d5eebb9fc Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 16 Dec 2019 14:23:16 +0100 Subject: [PATCH] add types for windows-mutex (#40873) --- types/windows-mutex/index.d.ts | 12 +++++++++++ types/windows-mutex/tsconfig.json | 23 ++++++++++++++++++++++ types/windows-mutex/tslint.json | 1 + types/windows-mutex/windows-mutex-tests.ts | 8 ++++++++ 4 files changed, 44 insertions(+) create mode 100644 types/windows-mutex/index.d.ts create mode 100644 types/windows-mutex/tsconfig.json create mode 100644 types/windows-mutex/tslint.json create mode 100644 types/windows-mutex/windows-mutex-tests.ts diff --git a/types/windows-mutex/index.d.ts b/types/windows-mutex/index.d.ts new file mode 100644 index 0000000000..dc1e296cce --- /dev/null +++ b/types/windows-mutex/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for windows-mutex 0.4 +// Project: https://github.com/Microsoft/node-windows-mutex +// Definitions by: Benjamin Pasero +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class Mutex { + constructor(name: string); + isActive(): boolean; + release(): void; +} + +export function isActive(name: string): boolean; diff --git a/types/windows-mutex/tsconfig.json b/types/windows-mutex/tsconfig.json new file mode 100644 index 0000000000..1b6f1efcfd --- /dev/null +++ b/types/windows-mutex/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "windows-mutex-tests.ts" + ] +} diff --git a/types/windows-mutex/tslint.json b/types/windows-mutex/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/windows-mutex/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/windows-mutex/windows-mutex-tests.ts b/types/windows-mutex/windows-mutex-tests.ts new file mode 100644 index 0000000000..4f57f7a935 --- /dev/null +++ b/types/windows-mutex/windows-mutex-tests.ts @@ -0,0 +1,8 @@ +import * as windowsMutex from "windows-mutex"; + +const name = 'mutex-name'; + +windowsMutex.isActive(name); +const mutex = new windowsMutex.Mutex(name); +mutex.isActive(); +mutex.release();