Merge pull request #25797 from pluma/rmfr

Add typings for rmfr
This commit is contained in:
Ron Buckton
2018-05-18 16:34:24 -07:00
committed by GitHub
4 changed files with 73 additions and 0 deletions
+17
View 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
View 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
View 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
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }