diff --git a/types/mv/index.d.ts b/types/mv/index.d.ts new file mode 100644 index 0000000000..02e076a07b --- /dev/null +++ b/types/mv/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for mv 2.1 +// Project: https://github.com/andrewrk/node-mv +// Definitions by: Miloslav Nenadál +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Options { + mkdirp?: boolean; + clobber?: boolean; +} + +interface Mv { + ( + src: string, + dest: string, + options: Options, + callback: (error: any) => void + ): void; + (src: string, dest: string, callback: (error: any) => void): void; +} + +declare const inst: Mv; + +export = inst; diff --git a/types/mv/mv-tests.ts b/types/mv/mv-tests.ts new file mode 100644 index 0000000000..079fd0efec --- /dev/null +++ b/types/mv/mv-tests.ts @@ -0,0 +1,21 @@ +import * as mv from 'mv'; + +() => { + mv('/tmp/f1.txt', '/tmp/f2.txt', error => { + if (error) { + throw error; + } + }); + + mv('/tmp/f1.txt', '/tmp/f2.txt', {clobber: false}, error => { + if (error) { + throw error; + } + }); + + mv('/tmp/f1.txt', '/tmp/f2.txt', {mkdirp: true}, error => { + if (error) { + throw error; + } + }); +}; diff --git a/types/mv/tsconfig.json b/types/mv/tsconfig.json new file mode 100644 index 0000000000..5291015a15 --- /dev/null +++ b/types/mv/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", + "mv-tests.ts" + ] +} diff --git a/types/mv/tslint.json b/types/mv/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mv/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }