@cli-forge/parser 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,8 +66,14 @@ export type BaseType<T> = T extends {
66
66
  /**
67
67
  * Resolve a single option config to its final type.
68
68
  * Priority: choices > coerce > base type
69
+ *
70
+ * For array options, choices narrow the element type rather than replacing
71
+ * the entire type. e.g. `{ type: 'array', items: 'string', choices: ['a', 'b'] as const }`
72
+ * resolves to `('a' | 'b')[]`, not `'a' | 'b'`.
69
73
  */
70
- export type ResolveOptionType<T> = InferChoice<T> extends never ? InferCoerce<T, BaseType<T>> : InferChoice<T>;
74
+ export type ResolveOptionType<T> = InferChoice<T> extends never ? InferCoerce<T, BaseType<T>> : T extends {
75
+ type: 'array';
76
+ } ? InferChoice<T>[] : InferChoice<T>;
71
77
  /**
72
78
  * Wrap a resolved type with undefined if the option is optional.
73
79
  * Required options or options with defaults are never undefined.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cli-forge/parser",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },