mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
14
types/arrify/arrify-tests.ts
Normal file
14
types/arrify/arrify-tests.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import arrify = require("arrify");
|
||||
|
||||
arrify(null);
|
||||
arrify<number>(null);
|
||||
|
||||
arrify(undefined);
|
||||
arrify<number>(undefined);
|
||||
|
||||
arrify(1);
|
||||
arrify([2, 3]);
|
||||
|
||||
function test(val?: string | string[]) {
|
||||
arrify(val);
|
||||
}
|
||||
18
types/arrify/index.d.ts
vendored
Normal file
18
types/arrify/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for arrify 1.0.1
|
||||
// Project: https://github.com/sindresorhus/arrify
|
||||
// Definitions by: AnJun Wang <https://github.com/wanganjun>
|
||||
// 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<T>(val: undefined | null | T | T[]): T[];
|
||||
export = arrify;
|
||||
22
types/arrify/tsconfig.json
Normal file
22
types/arrify/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user