From ca49ffe5c8dc4f4afeb6067df80400b54b0b219d Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Thu, 24 Jan 2019 14:34:54 +0100 Subject: [PATCH] Add types for copyfiles --- types/copyfiles/copyfiles-tests.ts | 6 ++++++ types/copyfiles/index.d.ts | 30 ++++++++++++++++++++++++++++++ types/copyfiles/tsconfig.json | 23 +++++++++++++++++++++++ types/copyfiles/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/copyfiles/copyfiles-tests.ts create mode 100644 types/copyfiles/index.d.ts create mode 100644 types/copyfiles/tsconfig.json create mode 100644 types/copyfiles/tslint.json diff --git a/types/copyfiles/copyfiles-tests.ts b/types/copyfiles/copyfiles-tests.ts new file mode 100644 index 0000000000..e1549c3c82 --- /dev/null +++ b/types/copyfiles/copyfiles-tests.ts @@ -0,0 +1,6 @@ +import copyfiles = require('copyfiles'); + +copyfiles(['file'], () => {}); +copyfiles(['file'], error => {}); +copyfiles(['file'], {all: true}, error => {}); +copyfiles(['file'], 10, error => {}); diff --git a/types/copyfiles/index.d.ts b/types/copyfiles/index.d.ts new file mode 100644 index 0000000000..9fc6ecde87 --- /dev/null +++ b/types/copyfiles/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for copyfiles 2.1 +// Project: https://github.com/calvinmetcalf/copyfiles#readme +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace copyfiles { + interface Options { + /** include files & directories begining with a dot (.) */ + all?: boolean; + /** throw error if nothing is copied */ + error?: boolean; + /** pattern or glob to exclude */ + exclude?: string; + /** flatten the output */ + flat?: boolean; + /** do not overwrite destination files if they exist */ + soft?: boolean; + /** slice a path off the bottom of the paths */ + up?: number; + /** print more information to console */ + verbose?: boolean; + } + + type Callback = (error?: Error) => void; +} + +declare function copyfiles(paths: string[], options: copyfiles.Options | number, callback: copyfiles.Callback): void; +declare function copyfiles(paths: string[], callback: copyfiles.Callback): void; + +export = copyfiles; diff --git a/types/copyfiles/tsconfig.json b/types/copyfiles/tsconfig.json new file mode 100644 index 0000000000..83672e27b7 --- /dev/null +++ b/types/copyfiles/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "copyfiles-tests.ts" + ] +} diff --git a/types/copyfiles/tslint.json b/types/copyfiles/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/copyfiles/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }