home.social

#yargs — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #yargs, aggregated by home.social.

  1. Commander.jsの.conflicts().implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。

    でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。

    このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。

    https://zenn.dev/hongminhee/articles/6ba2a6247ec0c4

    #Optique #Commander #Yargs #TypeScript #JavaScript #CLI

  2. Commander.jsの.conflicts().implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。

    でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。

    このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。

    https://zenn.dev/hongminhee/articles/6ba2a6247ec0c4

    #Optique #Commander #Yargs #TypeScript #JavaScript #CLI

  3. Commander.jsの.conflicts().implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。

    でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。

    このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。

    https://zenn.dev/hongminhee/articles/6ba2a6247ec0c4

    #Optique #Commander #Yargs #TypeScript #JavaScript #CLI

  4. Commander.jsの.conflicts().implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。

    でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。

    このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。

    https://zenn.dev/hongminhee/articles/6ba2a6247ec0c4

    #Optique #Commander #Yargs #TypeScript #JavaScript #CLI

  5. Commander.jsの.conflicts().implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。

    でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。

    このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。

    https://zenn.dev/hongminhee/articles/6ba2a6247ec0c4

    #Optique #Commander #Yargs #TypeScript #JavaScript #CLI

  6. I wrote about a problem that's been bugging me with #Commander.js and #Yargs: .conflicts() and .implies() enforce constraints at runtime, but the type you get back is still a flat object with every field optional. The compiler has no idea which options belong together.

    The post walks through what happens when you express the same constraints in the parser structure instead, and how #TypeScript turns that into a discriminated union where each branch carries only its own fields.

    Second half covers a less obvious question: what happens when values come from env vars, config files, or prompts instead of argv, and whether the constraints should still hold across all of them.

    https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli

    #JavaScript #CLI #Optique

  7. I wrote about a problem that's been bugging me with #Commander.js and #Yargs: .conflicts() and .implies() enforce constraints at runtime, but the type you get back is still a flat object with every field optional. The compiler has no idea which options belong together.

    The post walks through what happens when you express the same constraints in the parser structure instead, and how #TypeScript turns that into a discriminated union where each branch carries only its own fields.

    Second half covers a less obvious question: what happens when values come from env vars, config files, or prompts instead of argv, and whether the constraints should still hold across all of them.

    https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli

    #JavaScript #CLI #Optique

  8. I wrote about a problem that's been bugging me with #Commander.js and #Yargs: .conflicts() and .implies() enforce constraints at runtime, but the type you get back is still a flat object with every field optional. The compiler has no idea which options belong together.

    The post walks through what happens when you express the same constraints in the parser structure instead, and how #TypeScript turns that into a discriminated union where each branch carries only its own fields.

    Second half covers a less obvious question: what happens when values come from env vars, config files, or prompts instead of argv, and whether the constraints should still hold across all of them.

    https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli

    #JavaScript #CLI #Optique

  9. I wrote about a problem that's been bugging me with #Commander.js and #Yargs: .conflicts() and .implies() enforce constraints at runtime, but the type you get back is still a flat object with every field optional. The compiler has no idea which options belong together.

    The post walks through what happens when you express the same constraints in the parser structure instead, and how #TypeScript turns that into a discriminated union where each branch carries only its own fields.

    Second half covers a less obvious question: what happens when values come from env vars, config files, or prompts instead of argv, and whether the constraints should still hold across all of them.

    https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli

    #JavaScript #CLI #Optique

  10. I wrote about a problem that's been bugging me with #Commander.js and #Yargs: .conflicts() and .implies() enforce constraints at runtime, but the type you get back is still a flat object with every field optional. The compiler has no idea which options belong together.

    The post walks through what happens when you express the same constraints in the parser structure instead, and how #TypeScript turns that into a discriminated union where each branch carries only its own fields.

    Second half covers a less obvious question: what happens when values come from env vars, config files, or prompts instead of argv, and whether the constraints should still hold across all of them.

    https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli

    #JavaScript #CLI #Optique

  11. this thing works on one end by validating a config file loaded by . on the other end it adds some fluent API methods to to set metadata on the schema which is then used—in combination with what zod already gives you—to make calls into definition options, positionals, etc.

    wish zod made it easier to extend a la jquery plugins. not sure why it doesn’t, but curious to know why. there’s no way around module augmentation of course.

  12. What is your favourite #typescript #cli library? I have #yargs but am having some difficulty extracting common parts out of command handlers (initializing and tearing down external state is duplicated).

  13. Anyone with experience with #yargs #yargsjs available to help me out? Trying to use commandDir here in /bin to load commands from /lib but it seems the positional arguments only work for the first command and not the other ones? am I doing something wrong?

    github.com/jkirchartz/pos2trac