From 69b5719e321ccedda47c60d8759ee53b462fa384 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Wed, 19 Dec 2018 00:02:08 +0000 Subject: [PATCH] [parents] Add parents@1.0.1 definition --- types/parents/index.d.ts | 17 +++++++++++++++++ types/parents/parents-tests.ts | 9 +++++++++ types/parents/tsconfig.json | 23 +++++++++++++++++++++++ types/parents/tslint.json | 1 + 4 files changed, 50 insertions(+) create mode 100644 types/parents/index.d.ts create mode 100644 types/parents/parents-tests.ts create mode 100644 types/parents/tsconfig.json create mode 100644 types/parents/tslint.json diff --git a/types/parents/index.d.ts b/types/parents/index.d.ts new file mode 100644 index 0000000000..ee52f7a92b --- /dev/null +++ b/types/parents/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for parents 1.0 +// Project: https://github.com/substack/node-parents +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Return an array of the parent directories of 'dir', including and starting with 'dir'. + * If a dir isn't specified, process.cwd() will be used. + * Optionally specify an 'opts.platform' to control whether the separator and + * paths works the unixy way with '/' or the windowsy way where sometimes things use '/' and + * sometimes they use '\\' and also there are leading drive letters and other exotic features. + * If 'opts.platform' isn't specified, 'process.platform' will be used. + * Anything that matches /^win/ will use the windowsy behavior. + */ +declare function parents(dir?: string, opts?: { platform?: string }): string[]; + +export = parents; diff --git a/types/parents/parents-tests.ts b/types/parents/parents-tests.ts new file mode 100644 index 0000000000..a20575aaa3 --- /dev/null +++ b/types/parents/parents-tests.ts @@ -0,0 +1,9 @@ +import parents = require("parents"); + +function test(): string[] { + const res1 = parents("root/user/projects/ts"); + const res2 = parents("root\\user\\projects\\ts", { platform: "win" }); + const res3 = parents(); + const res4 = parents(undefined); + return res1 || res2 || res3 || res4; +} diff --git a/types/parents/tsconfig.json b/types/parents/tsconfig.json new file mode 100644 index 0000000000..799f376572 --- /dev/null +++ b/types/parents/tsconfig.json @@ -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", + "parents-tests.ts" + ] +} \ No newline at end of file diff --git a/types/parents/tslint.json b/types/parents/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parents/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }