From 09b8a3e046c820747f9a61dcf4fd95f78b10b9aa Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Thu, 24 Aug 2017 16:38:07 +0200 Subject: [PATCH] [chmodr] add typings --- types/chmodr/chmodr-tests.ts | 14 ++++++++++++++ types/chmodr/index.d.ts | 17 +++++++++++++++++ types/chmodr/tsconfig.json | 22 ++++++++++++++++++++++ types/chmodr/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/chmodr/chmodr-tests.ts create mode 100644 types/chmodr/index.d.ts create mode 100644 types/chmodr/tsconfig.json create mode 100644 types/chmodr/tslint.json diff --git a/types/chmodr/chmodr-tests.ts b/types/chmodr/chmodr-tests.ts new file mode 100644 index 0000000000..886dc9e3db --- /dev/null +++ b/types/chmodr/chmodr-tests.ts @@ -0,0 +1,14 @@ +import chmodr = require('chmodr'); +import { URL } from 'url'; + +chmodr('', '', err => { + err; // $ExpectType ErrnoException +}); +chmodr(new Buffer(''), '', () => {}); +chmodr(new URL(''), '', () => {}); +chmodr(new URL(''), 1, () => {}); + +chmodr.sync('', ''); +chmodr.sync(new Buffer(''), ''); +chmodr.sync(new URL(''), ''); +chmodr.sync(new URL(''), 1); diff --git a/types/chmodr/index.d.ts b/types/chmodr/index.d.ts new file mode 100644 index 0000000000..16eeaf7cbd --- /dev/null +++ b/types/chmodr/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for chmodr 1.0 +// Project: https://github.com/isaacs/chmodr#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import { URL } from 'url'; + +export = chmodr; + +declare function chmodr(path: chmodr.PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + +declare namespace chmodr { + function sync(path: PathLike, mode: string | number): void; + + type PathLike = string | Buffer | URL; +} diff --git a/types/chmodr/tsconfig.json b/types/chmodr/tsconfig.json new file mode 100644 index 0000000000..5aa0c9aac2 --- /dev/null +++ b/types/chmodr/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", + "chmodr-tests.ts" + ] +} diff --git a/types/chmodr/tslint.json b/types/chmodr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chmodr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }