From 06b82c4e40f56e97c437e2f8494383bcb13d87a1 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Fri, 24 Jan 2020 07:45:53 +1300 Subject: [PATCH] feat: Add types for group-array (#41819) Signed-off-by: Richie Bendall --- types/group-array/group-array-tests.ts | 12 ++++++++++++ types/group-array/index.d.ts | 9 +++++++++ types/group-array/tsconfig.json | 23 +++++++++++++++++++++++ types/group-array/tslint.json | 1 + 4 files changed, 45 insertions(+) create mode 100644 types/group-array/group-array-tests.ts create mode 100644 types/group-array/index.d.ts create mode 100644 types/group-array/tsconfig.json create mode 100644 types/group-array/tslint.json diff --git a/types/group-array/group-array-tests.ts b/types/group-array/group-array-tests.ts new file mode 100644 index 0000000000..a286e40f76 --- /dev/null +++ b/types/group-array/group-array-tests.ts @@ -0,0 +1,12 @@ +import groupArray = require("group-array"); + +const input = [ + { tag: 'one', content: 'A' }, + { tag: 'one', content: 'B' }, + { tag: 'two', content: 'C' }, + { tag: 'two', content: 'D' }, + { tag: 'three', content: 'E' }, + { tag: 'three', content: 'F' } +]; + +groupArray(input, 'tag'); // $ExpectType object diff --git a/types/group-array/index.d.ts b/types/group-array/index.d.ts new file mode 100644 index 0000000000..3efa2f710a --- /dev/null +++ b/types/group-array/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for group-array 1.0 +// Project: https://github.com/doowb/group-array +// Definitions by: Richie Bendall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function groupArray(arr: object[], ...props: string[]): object; +declare function groupArray(arr: object[]): object[]; + +export = groupArray; diff --git a/types/group-array/tsconfig.json b/types/group-array/tsconfig.json new file mode 100644 index 0000000000..38aaf6384b --- /dev/null +++ b/types/group-array/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "group-array-tests.ts" + ] +} diff --git a/types/group-array/tslint.json b/types/group-array/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/group-array/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }