Add types for copyfiles

This commit is contained in:
Florian Keller 2019-01-24 14:34:54 +01:00
parent d5fe4dcadb
commit ca49ffe5c8
No known key found for this signature in database
GPG Key ID: 5570D938BDA00C34
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import copyfiles = require('copyfiles');
copyfiles(['file'], () => {});
copyfiles(['file'], error => {});
copyfiles(['file'], {all: true}, error => {});
copyfiles(['file'], 10, error => {});

30
types/copyfiles/index.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
// Type definitions for copyfiles 2.1
// Project: https://github.com/calvinmetcalf/copyfiles#readme
// Definitions by: Florian Keller <https://github.com/ffflorian>
// 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;

View File

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

View File

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