|
1 | 1 | import { Base, CliTypeMap, CliTypes } from "./base";
|
2 |
| -import { ExclusiveGroupUnionAndUnconstrainedPlus } from "./exclusive"; |
| 2 | +import { |
| 3 | + ExclusiveGroupsByName, |
| 4 | + ExclusiveGroupUnionAndUnconstrainedPlus |
| 5 | +} from "./exclusive"; |
3 | 6 | import {
|
4 | 7 | Legacy,
|
5 | 8 | OptionCliType,
|
@@ -33,22 +36,31 @@ export type Definitions<C extends Base.Config> = {
|
33 | 36 | readonly disableInCLI?: boolean;
|
34 | 37 | readonly cliAliases?: string[];
|
35 | 38 | readonly cliChoices?: string[] | number[];
|
36 |
| - } & (void extends OptionHasCliType<C, N> |
37 |
| - ? { |
38 |
| - readonly cliType?: CliTypeMap<CliTypes> | null; |
39 |
| - } |
| 39 | + // exclusiveGroups (conflicts) |
| 40 | + } & (C[ExclusiveGroupsByName<C, N>] extends never |
| 41 | + ? {} |
40 | 42 | : {
|
41 |
| - readonly cliType?: CliTypeMap<OptionCliType<C, N>> | null; |
42 |
| - readonly cliCoerce?: ( |
43 |
| - cliType: OptionCliType<C, N> |
44 |
| - ) => OptionRawType<C, N>; |
| 43 | + readonly conflicts: ExclusiveGroupsByName<C, N>[]; |
45 | 44 | }) &
|
| 45 | + // cliType |
| 46 | + (void extends OptionHasCliType<C, N> |
| 47 | + ? { |
| 48 | + readonly cliType?: CliTypeMap<CliTypes> | null; |
| 49 | + } |
| 50 | + : { |
| 51 | + readonly cliType?: CliTypeMap<OptionCliType<C, N>> | null; |
| 52 | + readonly cliCoerce?: ( |
| 53 | + cliType: OptionCliType<C, N> |
| 54 | + ) => OptionRawType<C, N>; |
| 55 | + }) & |
| 56 | + // hasDefault |
46 | 57 | (void extends OptionHasDefault<C, N>
|
47 | 58 | ? {}
|
48 | 59 | : {
|
49 | 60 | readonly default: (config: InternalConfig<C>) => OptionType<C, N>;
|
50 | 61 | readonly defaultDescription?: string;
|
51 | 62 | }) &
|
| 63 | + // hasLegacy |
52 | 64 | (void extends OptionHasLegacy<C, N>
|
53 | 65 | ? {}
|
54 | 66 | : {
|
|
0 commit comments