From a6f6d0660eb2b48a33f14a84a69f2cd89c9ed543 Mon Sep 17 00:00:00 2001 From: Anjun Wang Date: Mon, 10 Jul 2017 16:47:10 +0800 Subject: [PATCH] add arrify 1.0.1 --- types/arrify/arrify-tests.ts | 14 ++++++++++++++ types/arrify/index.d.ts | 18 ++++++++++++++++++ types/arrify/tsconfig.json | 22 ++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 types/arrify/arrify-tests.ts create mode 100644 types/arrify/index.d.ts create mode 100644 types/arrify/tsconfig.json diff --git a/types/arrify/arrify-tests.ts b/types/arrify/arrify-tests.ts new file mode 100644 index 0000000000..319e86897a --- /dev/null +++ b/types/arrify/arrify-tests.ts @@ -0,0 +1,14 @@ +import arrify = require("arrify"); + +arrify(null); +arrify(null); + +arrify(undefined); +arrify(undefined); + +arrify(1); +arrify([2, 3]); + +function test(val?: string | string[]) { + arrify(val); +} diff --git a/types/arrify/index.d.ts b/types/arrify/index.d.ts new file mode 100644 index 0000000000..fb552e161e --- /dev/null +++ b/types/arrify/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for arrify 1.0.1 +// Project: https://github.com/sindresorhus/arrify +// Definitions by: AnJun Wang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * @example + * arrify(undefined) // returns [] + * @example + * arrify(null) // returns [] + * @example + * arrify(1) // returns [1] + * @example + * arrify([2, 3]) // returns [2, 3] + * @param val + */ +declare function arrify(val: undefined | null | T | T[]): T[]; +export = arrify; diff --git a/types/arrify/tsconfig.json b/types/arrify/tsconfig.json new file mode 100644 index 0000000000..b2579c233e --- /dev/null +++ b/types/arrify/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "arrify-tests.ts" + ] +} \ No newline at end of file