Commander.jsの.conflicts()や.implies()は、排他的な組み合わせをランタイムではちゃんと検出してくれます。
でも.opts()の型は賢くならず、戻り値は結局string | undefinedのままです。どのオプションが同時に使えないのかを、TypeScriptは知りません。
このズレをパーサーコンビネータでどう型に落とし込めるか、Yargsとの比較も含めて書きました。後半では、環境変数・設定ファイル・対話プロンプトまで同じ型保証を広げる話もしています。
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
From five optional fields to a discriminated union: CLI parsing with Optique 1.0
https://hackers.pub/@hongminhee/2026/optique-10-discriminated-unions-for-cli
#Optique 1.0.0을 릴리스했습니다.
Haskell의 optparse-applicative 스타일의 #TypeScript #CLI 파서가 필요해서 만들었습니다. 작은 타입 파서들을 조합하면 TypeScript가 결과 타입을 자동으로 추론합니다. 서브커맨드, 옵션 간 의존성, 셸 완성, 맨(man) 페이지 생성 등을 지원하고, #Deno, #Node.js, #Bun 등에서 동작합니다.
이번 버전에서는 @optique/env (환경 변수 폴백) 패키지와 @optique/inquirer (Inquirer.js 프롬프트 폴백) 패키지를 추가했습니다. API의 어색한 부분들도 많이 정리하고, 다섯 가지 셸의 완성 스크립트 버그도 한꺼번에 잡았습니다.
JSR과 npm에서 설치하실 수 있습니다.

Optique is a type-safe combinatorial CLI parser for TypeScript, inspired by Haskell's optparse-applicative and TypeScript's Zod. It takes a functional approach: you compose small, typed parsers int...
#Optique 1.0.0 is out! If you build #CLI tools with #TypeScript, it might be worth a look.
I started it because I wanted a TypeScript CLI parser that felt more like optparse-applicative than the usual builder-style APIs. You build up small typed parsers, compose them, and TypeScript infers the result. It handles subcommands, option dependencies, shell completion, and man pages, and it runs on #Deno, #Node.js, and #Bun.
For 1.0 I added @optique/env, so env vars can fill in missing flags, and @optique/inquirer, so missing values can fall back to Inquirer.js prompts. I also cleaned up a lot of awkward API edges and fixed a long backlog of completion bugs across five shells.
Packages are on JSR and npm.

Optique is a type-safe combinatorial CLI parser for TypeScript, inspired by Haskell's optparse-applicative and TypeScript's Zod. It takes a functional approach: you compose small, typed parsers int...
#Question aux #spécialistes des halos solaires : une traînée d'avion croisant un halo solaire peut-elle générer elle-même un "phénomène" optique occasionnant lui-même un mini halo ?
Je ne pense pas que le petit cercle que l'on voit vers "2H" au bord du halo soit dû à l'objectif. I semble y avoir une zone colorée en bleu sur la traînée d'avion au centre du petit cercle.
Question for solar halo #experts: Can a contrail crossing a solar halo create an optical “phenomenon” that itself produces a mini-halo?
I don’t think the tiny circle visible around “2 o’clock” at the edge of the solar halo is due to the lens.
Optique just crossed 600 GitHub stars!
For those unfamiliar: #Optique is a #CLI parsing library for #TypeScript that takes a parser combinator approach, inspired by Haskell's optparse-applicative. The core idea is “parse, don't validate”—you express constraints like mutually exclusive options or dependent flags through types, and TypeScript infers the rest automatically. No runtime validation boilerplate needed.
It started as something I built out of frustration while working on Fedify, an ActivityPub framework, when no existing CLI library could express the constraints I needed in a type-safe way. Apparently I wasn't the only one who felt that way.
Thank you all for the support.