Join Nostr
2026-12-01 16:53:15 UTC

Axel Rauschmayer on Nostr: 1/ Quick way of using Node’s util.parseArgs() in TypeScript: const options = { ...

1/ Quick way of using Node’s util.parseArgs() in TypeScript:

const options = {
help: {
'🟢': 'Show this help text',
type: 'boolean',
short: 'h',
},
// ...
} satisfies Record<string, ParseArgsOptionDescriptor & { '🟢': string }>;
const { values, positionals } = util.parseArgs({ options, allowPositionals: true });

https://nodejs.org/api/util.html#utilparseargsconfig