Skip to content

Commit 904569f

Browse files
committed
refactor(parser): use interface for flag display property
1 parent b728d26 commit 904569f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/parser/src/types.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ import type { IsAny, MaybeArray, Prettify } from "@clerc/utils";
22

33
import type { KNOWN_FLAG, PARAMETER, UNKNOWN_FLAG } from "./iterator";
44

5-
export type FlagDefaultValue<T = unknown> =
6-
| T
7-
| ((() => T) & { display?: string });
5+
export interface FlagDefaultValueFunction<T> {
6+
(): T;
7+
display?: string;
8+
}
9+
10+
export type FlagDefaultValue<T = unknown> = T | FlagDefaultValueFunction<T>;
811

912
/**
1013
* Defines how a string input is converted to the target type T.
1114
*
1215
* @template T The target type.
1316
*/
14-
export type FlagTypeFunction<T = unknown> = ((value: string) => T) & {
17+
export interface FlagTypeFunction<T = unknown> {
18+
(value: string): T;
1519
/**
1620
* Optional display name for the type, useful in help output.
1721
* If provided, this will be shown instead of the function name.
1822
*/
1923
display?: string;
20-
};
24+
}
2125

2226
/**
2327
* A callback function to conditionally stop parsing.

0 commit comments

Comments
 (0)