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.:
// interfaces/config.ts
export interface IFlags {
flag1: string;
flag2: boolean;
flag3: number;
}
export interface IConfig {
argv: meow.IResult<IFlags>; // similar to meow.Result but pass in flag type not flag def
some: string;
other: boolean;
configs: number[];
}
// config.ts
import {IFlags, IConfig} from './interfaces/config.ts';
const argv = anotherWayToMeow<IFlags>( // similar to current meow() but pass in flag type not def
`Usage: xxxxxxx`,
{
flags: {
// better to have typecheck here,
// if not at least can predefine the result flags
flag1: { alias: 'a', type: 'string' },
flag2: { alias: 'b' }, // error because missing type: 'boolean'
// error because missing flag3
},
},
)
const some = 'xxxx';
const other = process.env.MY_ENV === 'other';
const configs = [1,2,3];
const config: IConfig = { argv, some, other, configs };
export default config;
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too