mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-08 19:20:05 +00:00
Add typings for rmfr
This commit is contained in:
17
types/rmfr/index.d.ts
vendored
Normal file
17
types/rmfr/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for rmfr 2.0
|
||||
// Project: https://github.com/shinnn/rmfr#readme
|
||||
// Definitions by: Alan Plum <https://github.com/pluma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import rimraf = require("rimraf");
|
||||
|
||||
declare namespace rmfr {
|
||||
type Options = rimraf.Options & {
|
||||
glob?: rimraf.Options["glob"] | true;
|
||||
disableGlob?: never;
|
||||
};
|
||||
}
|
||||
declare function rmfr(path: string, options?: rmfr.Options): Promise<void>;
|
||||
|
||||
export = rmfr;
|
||||
39
types/rmfr/rmfr-tests.ts
Normal file
39
types/rmfr/rmfr-tests.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import rmfr = require("rmfr");
|
||||
|
||||
(async () => {
|
||||
// happy
|
||||
await rmfr("tmp_file");
|
||||
await rmfr("tmp_d*", {});
|
||||
await rmfr("../{tmp_d*,test.js}", {
|
||||
glob: {
|
||||
cwd: "node_modules",
|
||||
ignore: "some_filename"
|
||||
}
|
||||
});
|
||||
await rmfr("test.js", {
|
||||
glob: {
|
||||
cwd: "this/directory/does/not/exist"
|
||||
}
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
await rmfr(".gitignore", { unlink: (path, cb) => cb(new Error()) });
|
||||
// $ExpectError
|
||||
await rmfr();
|
||||
// $ExpectError
|
||||
await rmfr("<", { o: "O" }, "/");
|
||||
// $ExpectError
|
||||
await rmfr(["1"], { glob: true });
|
||||
// $ExpectError
|
||||
await rmfr("foo", 1);
|
||||
// $ExpectError
|
||||
await rmfr("foo", { chmod: new Set(["a"]) });
|
||||
// $ExpectError
|
||||
await rmfr("foo", {
|
||||
maxBusyTries: "foo",
|
||||
emfileWait: "bar",
|
||||
glob: "baz"
|
||||
});
|
||||
// $ExpectError
|
||||
await rmfr("foo", { disableGlob: true });
|
||||
})();
|
||||
16
types/rmfr/tsconfig.json
Normal file
16
types/rmfr/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "rmfr-tests.ts"]
|
||||
}
|
||||
1
types/rmfr/tslint.json
Normal file
1
types/rmfr/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user