mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
Adding a type definition for del
This is useful for people who want to write their gulpfile in TypeScript.
This commit is contained in:
28
del/del-tests.ts
Normal file
28
del/del-tests.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="./del.d.ts"/>
|
||||
import del = require("del");
|
||||
|
||||
var paths = ["build", "dist/**/*.js"];
|
||||
|
||||
del(["tmp/*.js", "!tmp/unicorn.js"], (err, paths) => {
|
||||
console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||
});
|
||||
|
||||
del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}, (err, paths) => {
|
||||
console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||
});
|
||||
|
||||
del("tmp/*.js", (err, paths) => {
|
||||
console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||
});
|
||||
|
||||
del("tmp/*.js", {force: true}, (err, paths) => {
|
||||
console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||
});
|
||||
|
||||
del.sync(["tmp/*.js", "!tmp/unicorn.js"]);
|
||||
|
||||
del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
|
||||
|
||||
del.sync("tmp/*.js");
|
||||
|
||||
del.sync("tmp/*.js", {force: true});
|
||||
28
del/del.d.ts
vendored
Normal file
28
del/del.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for del
|
||||
// Project: https://github.com/sindresorhus/del
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../glob/glob.d.ts"/>
|
||||
|
||||
declare module "del" {
|
||||
import glob = require("glob");
|
||||
|
||||
function Del(pattern: string, callback: (err: Error, deletedFiles: string[]) => any): void;
|
||||
|
||||
function Del(pattern: string, options: Del.Options, callback: (err: Error, deletedFiles: string[]) => any): void;
|
||||
|
||||
function Del(patterns: string[], callback: (err: Error, deletedFiles: string[]) => any): void;
|
||||
|
||||
function Del(patterns: string[], options: Del.Options, callback: (err: Error, deletedFiles: string[]) => any): void;
|
||||
module Del {
|
||||
function sync(pattern: string, options?: Options): void;
|
||||
function sync(patterns: string[], options?: Options): void;
|
||||
|
||||
interface Options extends glob.IOptions {
|
||||
force?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export = Del;
|
||||
}
|
||||
Reference in New Issue
Block a user