File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import {
22 parseArgs as nodeParseArgs ,
3- type ParseArgsConfig ,
3+ type ParseArgsConfig as NodeParseArgsConfig ,
4+ type ParseArgsOptionDescriptor as NodeParseArgsOptionDescriptor ,
45 type ParseArgsOptionsConfig ,
56} from 'node:util' ;
67
8+ type ParseArgsOptionDescriptor = Omit < NodeParseArgsOptionDescriptor , 'default' > & {
9+ default ?: never ;
10+ } ;
11+
12+ type ParseArgsConfig = Omit < NodeParseArgsConfig , 'options' > & {
13+ options ?: Record < string , ParseArgsOptionDescriptor > ;
14+ } ;
15+
716type CamelCase < Value extends string > = Value extends `${infer Head } -${infer Tail } `
817 ? `${Head } ${Capitalize < CamelCase < Tail > > } `
918 : Value ;
Original file line number Diff line number Diff line change 11import { expect , test } from 'rstack/test' ;
22import { parseArgs } from '../../src/cli/args.ts' ;
33
4+ const assertDefaultIsUnsupported = ( ) : void => {
5+ parseArgs ( {
6+ options : {
7+ option : {
8+ type : 'string' ,
9+ // @ts -expect-error `default` is intentionally unsupported by this helper.
10+ default : 'default' ,
11+ } ,
12+ } ,
13+ } ) ;
14+ } ;
15+
16+ void assertDefaultIsUnsupported ;
17+
418test . each ( [
519 [ '--long-option' , 'kebab' ] ,
620 [ '--longOption' , 'camel' ] ,
You can’t perform that action at this time.
0 commit comments