mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
[array-same] Add types (#63236)
This commit is contained in:
7
types/array-same/array-same-tests.ts
Normal file
7
types/array-same/array-same-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import hasSameElements = require('array-same');
|
||||
|
||||
hasSameElements([1, 2], [2, 1]); // $ExpectType boolean
|
||||
hasSameElements(['a', 'b'], ['b', 'c']); // $ExpectType boolean
|
||||
hasSameElements([1, 2, 3], [1, 2]); // $ExpectType boolean
|
||||
hasSameElements([1, 2] as const, [1, 2, 3] as const); // $ExpectType boolean
|
||||
hasSameElements([1, 2, 3], [1, 2], [1, 2]); // $ExpectType boolean
|
||||
17
types/array-same/index.d.ts
vendored
Normal file
17
types/array-same/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for array-same 1.0
|
||||
// Project: https://github.com/dfcreative/array-same
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = hasSameElements;
|
||||
|
||||
/**
|
||||
* Check one or more array whether they have the same items as `source`.
|
||||
*
|
||||
* @example
|
||||
* import hasSameElements = require('array-same');
|
||||
*
|
||||
* hasSameElements([1, 2], [2, 1]); // true
|
||||
* hasSameElements([1, 2, 3], [1, 2]); // false
|
||||
*/
|
||||
declare function hasSameElements<T>(source: readonly T[], ...args: ReadonlyArray<readonly T[]>): boolean;
|
||||
23
types/array-same/tsconfig.json
Normal file
23
types/array-same/tsconfig.json
Normal 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",
|
||||
"array-same-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/array-same/tslint.json
Normal file
1
types/array-same/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user