unjs / citty

πŸŒ† Elegant CLI Builder
Other
729 stars 23 forks source link

fix: strict args #149

Closed Teages closed 3 months ago

Teages commented 3 months ago

πŸ”— Linked issue

148

❓ Type of change

πŸ“š Description

Resolves #148

I noticed that citty didn't provide null-safety on context.args even strict is true, this will break some type checks. In this pr I make all args be nullable first, then make required and items with default values ​​non-nullable.

And ParsedArgs type has some errors when parsing enum, it just return the options array itself but the correct should be the type of items in the array. In this pr I just simplly fixed it, but the best fix should make the type more precise.

πŸ“ Checklist

Teages commented 3 months ago

oops I just noticed #132, sorry to bother you :(