Skip to content
Myr

Make OptionValueSource a string with well-known values for auto-complete. (#1983)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by John Gee · committed by GitHub · parent f5413db · Browse files · 1 file+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−1 removed

  • other:+10 added−1 removed

1 file+10 added−1 removed

modified:typings/index.d.ts+10 added-1 removed
3 unmodified lines
4// Using method rather than property for method-signature-style, to document method overloads separately. Allow either.5/* eslint-disable @typescript-eslint/method-signature-style */6/* eslint-disable @typescript-eslint/no-explicit-any */78// This is a trick to encourage editor to suggest the known literals while still9// allowing any BaseType value.10// References:11// - https://github.com/microsoft/TypeScript/issues/2972912// - https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts13// - https://github.com/sindresorhus/type-fest/blob/main/source/primitive.d.ts14type LiteralUnion<LiteralType, BaseType extends string | number> = LiteralType | (BaseType & Record<never, never>);1516export class CommanderError extends Error {17 code: string;18 exitCode: number;19 message: string;
259 unmodified lines
279}280281export type AddHelpTextPosition = 'beforeAll' | 'before' | 'after' | 'afterAll';282export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction';275export type OptionValueSource = 'default' | 'config' | 'env' | 'cli' | 'implied';283// The source is a string so author can define their own too.284export type OptionValueSource = LiteralUnion<'default' | 'config' | 'env' | 'cli' | 'implied', string> | undefined;285286export type OptionValues = Record<string, any>;287288export class Command {
614 unmodified lines