Support different types for mutuallyExclusiveOptions?
See original GitHub issueSometimes it’s useful if mutually exclusive options could be of different types. In my concrete case, an option is either a path to a File
, or a String
name of a resource. Currently, that’s not supported as all mutually exclusive options need to be of the same type.
I tried to work around that by also treating the File
as a String
, but I did not find an elegant way then to determine which of the two options was given and whether I should convert the String
to a File
or not.
I acknowledge it’s not possible to support different types for all mutually exclusive options, but maybe as a work-around we could at least support two different types for the first two mandatory option1
and options2
parameters of mutuallyExclusiveOptions
?
In any case I’m also open to other suggestion how to elegantly tackle this issue.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
If you just want
Any
, then you can cast each option:I’m not sure why the type inference can’t figure out the types without a manual cast.
My fault, I forgot to call
.single()
🙄 Looking all good now, thanks!