Merge pull request #19423 from nenadalm/mv

[mv]: Add types
This commit is contained in:
Mine Starks 2017-08-29 12:48:59 -07:00 committed by GitHub
commit dff4f090fa
4 changed files with 67 additions and 0 deletions

23
types/mv/index.d.ts vendored Normal file
View File

@ -0,0 +1,23 @@
// Type definitions for mv 2.1
// Project: https://github.com/andrewrk/node-mv
// Definitions by: Miloslav Nenadál <https://github.com/nenadalm>
// 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;

21
types/mv/mv-tests.ts Normal file
View File

@ -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;
}
});
};

22
types/mv/tsconfig.json Normal file
View File

@ -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"
]
}

1
types/mv/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }