mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
Added type definitions for elv (#34153)
This commit is contained in:
14
types/elv/elv-tests.ts
Normal file
14
types/elv/elv-tests.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import elv = require('elv');
|
||||
|
||||
elv(''); // $ExpectType boolean
|
||||
|
||||
elv.behavior.enableFalse; // $ExpectedType boolean
|
||||
elv.behavior.enableNaN; // $ExpectedType boolean
|
||||
elv.behavior.enableNull; // $ExpectedType boolean
|
||||
elv.behavior.enableUndefined; // $ExpectedType boolean
|
||||
|
||||
elv.coalesce(''); // $ExpectType any
|
||||
elv.ncoalesce(''); // $ExpectType any
|
||||
elv.populated(''); // $ExpectType boolean
|
||||
elv.tryGet([], 0); // $ExpectType any
|
||||
elv.tryGet([], 0, ''); // $ExpectType any
|
||||
21
types/elv/index.d.ts
vendored
Normal file
21
types/elv/index.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// Type definitions for elv 2.2
|
||||
// Project: https://github.com/dsfields/elv#readme
|
||||
// Definitions by: Gary Parker <https://github.com/garyaparker>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function elv(val: any): boolean;
|
||||
|
||||
declare namespace elv {
|
||||
const behavior: {
|
||||
enableFalse: boolean
|
||||
enableNaN: boolean
|
||||
enableNull: boolean
|
||||
enableUndefined: boolean
|
||||
};
|
||||
function coalesce(...args: any[]): any;
|
||||
function ncoalesce(...args: any[]): any;
|
||||
function populated(val: any): boolean;
|
||||
function tryGet(val: ReadonlyArray<any>, index: number, def?: any): any;
|
||||
}
|
||||
|
||||
export = elv;
|
||||
24
types/elv/tsconfig.json
Normal file
24
types/elv/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"elv-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/elv/tslint.json
Normal file
1
types/elv/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user