New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS] Any way to predefine the flags then typecheck them in options? #129
Comments
Why do you need to predefine them? The Meow types are smart enough to use the correct types depending on what you specify in the // @NiGhTTraX |
That's because:
|
@whitetrefoil you don't need to pass a generic type to type Flags = {
foo: number;
}
const cli: { flags: Flags } = meow({
flags: {
foo: { type: 'number' }
}
}); You would get a type error if you tried to use |
@NiGhTTraX That's a nice workaround. I'll use it before I find a better way (if there is). Thanks a lot! |
The solution suggested by @NiGhTTraX sounds like the proper one to me. It's even the one used in Lines 8 to 16 in 629af48
|
Currently the type of flags are difficult to predefine, it'll be easier to write the
meow(..., ...)
function then get the returned type.But I'm trying to predefine the flags' type then use it to typecheck the
meow()
function. e.g.:The text was updated successfully, but these errors were encountered: