-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargue.test-d.ts
More file actions
42 lines (36 loc) · 775 Bytes
/
argue.test-d.ts
File metadata and controls
42 lines (36 loc) · 775 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
import { expectType } from 'tsd'
import { alias, expect, option, readOptions } from '../src/index.js'
expectType<'add' | 'install'>(expect('add', alias('install', 'i')))
expectType<{
input?: string
port?: number
plugins?: string[]
debug?: boolean
}>(
readOptions(
option('input', String),
option(alias('port', 'p'), Number),
option('plugins', Array),
option('debug', Boolean)
)
)
expectType<{
input: string
} | null>(
option('input', String)('', () => '', {})
)
expectType<{
port: number
} | null>(
option(alias('port', 'p'), Number)('', () => '', {})
)
expectType<{
plugins: string[]
} | null>(
option('plugins', Array)('', () => '', {})
)
expectType<{
debug: boolean
} | null>(
option('debug', Boolean)('', () => '', {})
)