cleye
cleye copied to clipboard
ignoreArgv callback with all 3 parameters results in type error
Bug description
See code below. It results in this typescript error:
No overload matches this call.
Overload 1 of 2, '(options: CliOptions<undefined, string[]>, callback?: CallbackFunction<TypeFlagWrapper<CliOptions<undefined, string[]>, string[]>> | undefined, argv?: string[] | undefined): { ...; }', gave the following error.
Type '(type: "known-flag" | "unknown-flag", flagOrArgv: string, value: string | undefined) => false' is not assignable to type 'IgnoreFunction'.
Target signature provides too few arguments. Expected 3 or more, but got 2.
Overload 2 of 2, '(options: CliOptions<Command<CommandOptions<string[]>, any>[], string[]>, callback?: CallbackFunction<TypeFlagWrapper<CliOptions<Command<CommandOptions<string[]>, any>[], string[]>, string[]>> | undefined, argv?: string[] | undefined): { ...; } | { ...; }', gave the following error.
Type '(type: "known-flag" | "unknown-flag", flagOrArgv: string, value: string | undefined) => false' is not assignable to type 'IgnoreFunction'.
Reproduction
const argv = cli({
name: 'foo',
ignoreArgv(type, flagOrArgv, value) {
return false
}
})
Node.js package manager
pnpm
Environment
System:
OS: macOS 13.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 2.11 GB / 32.00 GB
Shell: 5.2.15 - /opt/homebrew/bin/bash
Binaries:
Node: 18.18.2 - ~/.local/share/rtx/installs/node/18.18.2/bin/node
Yarn: 1.22.19 - ~/.local/share/rtx/installs/node/18.18.2/bin/yarn
npm: 9.8.1 - ~/.local/share/rtx/installs/node/18.18.2/bin/npm
pnpm: 8.9.2 - ~/.local/share/rtx/installs/node/18.18.2/bin/pnpm
Can you contribute a fix?
- [ ] Iām interested in opening a pull request for this issue.