mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
[dargs] add typings (#18889)
This commit is contained in:
committed by
Mohamed Hegazy
parent
8718d318ab
commit
6f61683fbf
@@ -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});
|
||||
Vendored
+20
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user