Type CLI command host/json options at the source
The CommandOptions interface in packages/cli/src/output/with-output.ts had an open `[key: string]: unknown` indexer, so every consumer of the global --host and --json options had to cast `options.host as string | undefined` at the call site. Add `host?: string` and `json?: boolean` to the interface and remove 29 redundant casts across 12 command files.
This commit is contained in:
@@ -10,6 +10,10 @@ import { render, renderError, toCommandError, defaultOutputOptions } from "./ren
|
||||
|
||||
/** Options that include output settings from global options */
|
||||
export interface CommandOptions extends Partial<OutputOptions> {
|
||||
/** Daemon host target from --host option */
|
||||
host?: string;
|
||||
/** JSON output flag from --json option */
|
||||
json?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user