-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathindex.test-d.ts
29 lines (25 loc) · 873 Bytes
/
index.test-d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {expectType, expectError} from 'tsd';
import dargs from './index.js';
const object = {
_: ['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(object, {excludes}));
expectType<string[]>(dargs(object, {includes}));
expectType<string[]>(dargs(object, {aliases}));
expectType<string[]>(dargs(object, {useEquals: false}));
expectType<string[]>(dargs(object, {shortFlag: true}));
expectType<string[]>(dargs(object, {ignoreTrue: true}));
expectType<string[]>(dargs(object, {ignoreFalse: true}));
expectType<string[]>(dargs(object, {allowCamelCase: true}));
expectError(dargs({_: 'foo'}));
expectError(dargs({'--': 'foo'}));