mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
[dargs] add typings (#18889)
This commit is contained in:
committed by
Mohamed Hegazy
parent
8718d318ab
commit
6f61683fbf
29
types/dargs/dargs-tests.ts
Normal file
29
types/dargs/dargs-tests.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import dargs = require('dargs');
|
||||
|
||||
const input = {
|
||||
_: ['some', 'option'],
|
||||
foo: 'bar',
|
||||
hello: true,
|
||||
cake: false,
|
||||
camelCase: 5,
|
||||
multiple: ['value', 'value2'],
|
||||
pieKind: 'cherry',
|
||||
sad: ':('
|
||||
};
|
||||
|
||||
const excludes = ['sad', /.*Kind$/];
|
||||
const includes = ['camelCase', 'multiple', 'sad', /^pie.*/];
|
||||
const aliases = {file: 'f'};
|
||||
|
||||
// $ExpectType string[]
|
||||
dargs(input, {excludes});
|
||||
dargs(input, {excludes, includes});
|
||||
dargs(input, {includes});
|
||||
dargs({
|
||||
foo: 'bar',
|
||||
hello: true,
|
||||
file: 'baz'
|
||||
}, {aliases});
|
||||
dargs({foo: 'bar'}, {useEquals: false});
|
||||
dargs({foo: 'bar'}, {ignoreFalse: true});
|
||||
dargs({fooBar: 'baz'}, {allowCamelCase: true});
|
||||
20
types/dargs/index.d.ts
vendored
Normal file
20
types/dargs/index.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for dargs 5.1
|
||||
// Project: https://github.com/sindresorhus/dargs#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = dargs;
|
||||
|
||||
declare function dargs(input: object, options?: dargs.Options): string[];
|
||||
|
||||
declare namespace dargs {
|
||||
interface Options {
|
||||
excludes?: ReadonlyArray<string | RegExp>;
|
||||
includes?: ReadonlyArray<string | RegExp>;
|
||||
aliases?: { [key: string]: string };
|
||||
useEquals?: boolean;
|
||||
ignoreFalse?: boolean;
|
||||
allowCamelCase?: boolean;
|
||||
}
|
||||
}
|
||||
22
types/dargs/tsconfig.json
Normal file
22
types/dargs/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",
|
||||
"dargs-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/dargs/tslint.json
Normal file
1
types/dargs/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user