mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Add types for copy
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import copy = require('copy');
|
||||
import File = require('vinyl');
|
||||
|
||||
copy.each(['a', 'b'], '.', { cwd: '..' }, () => {});
|
||||
copy.each(['a', 'b'], '.', { cwd: '..' }, (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
copy.each(['a', 'b'], '.', () => {});
|
||||
copy.each(['a', 'b'], '.', (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
|
||||
copy.one('a', '.', { cwd: '..' }, () => {});
|
||||
copy.one('a', '.', { cwd: '..' }, (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
copy.one('a', '.', () => {});
|
||||
copy.one('a', '.', (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
|
||||
copy(['a', 'b'], '.', { cwd: '..' }, () => {});
|
||||
copy(['a', 'b'], '.', { cwd: '..' }, (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
copy(['a', 'b'], '.', () => {});
|
||||
copy(['a', 'b'], '.', (error, files) => {
|
||||
error; // $ExpectType Error | null
|
||||
files; // $ExpectType File[] | undefined
|
||||
});
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for copy 0.3
|
||||
// Project: https://github.com/jonschlinkert/copy
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import File = require('vinyl');
|
||||
|
||||
declare namespace copy {
|
||||
function each(files: string[], dir: string, options: Options, callback: Callback): void;
|
||||
function each(files: string[], dir: string, callback: Callback): void;
|
||||
function one(pattern: string | object, dir: string, options: Options, callback: Callback): void;
|
||||
function one(pattern: string | object, dir: string, callback: Callback): void;
|
||||
|
||||
type Callback = (error: Error | null, files?: File[]) => void;
|
||||
|
||||
interface Options {
|
||||
cwd?: string;
|
||||
srcBase?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function copy(
|
||||
patterns: string | object | string[],
|
||||
dir: string,
|
||||
options: copy.Options,
|
||||
callback: copy.Callback,
|
||||
): void;
|
||||
declare function copy(patterns: string | object | string[], dir: string, callback: copy.Callback): void;
|
||||
|
||||
export = copy;
|
||||
@@ -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",
|
||||
"copy-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user