feat: Add types for group-array (#41819)

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2020-01-24 07:45:53 +13:00 committed by Ben Lichtman
parent 013ce96de7
commit 06b82c4e40
4 changed files with 45 additions and 0 deletions

View File

@ -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

9
types/group-array/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for group-array 1.0
// Project: https://github.com/doowb/group-array
// Definitions by: Richie Bendall <https://github.com/Richienb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function groupArray(arr: object[], ...props: string[]): object;
declare function groupArray(arr: object[]): object[];
export = groupArray;

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }