Commit 665fa01
authored
fix(types): improve type safety in command helpers (#7852)
* feat: Improve type safety in command-helpers
This commit improves the type safety of `src/utils/command-helpers.ts` by:
- Adding a `boolean` type to the `noColors` parameter in `safeChalk`.
- Adding `string` and `number` types to the parameters of `padLeft`.
- Importing the `Option` type from `commander` to correctly type the `sortOptions` function parameters and adding defensive checks to handle potentially `undefined` properties at runtime.
These changes eliminate three `@ts-expect-error` instances and strengthen the module's type safety and runtime robustness.
* chore: Use type-only import for commander Option
This commit updates the import of the `Option` type from `commander` to be a type-only import, following a suggestion from the code review. This is a best practice that makes the dependency explicit as a type-only dependency.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent f5b1c11 commit 665fa01
1 file changed
+6
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
81 | | - | |
| 79 | + | |
82 | 80 | | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | 83 | | |
86 | | - | |
| 84 | + | |
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
| |||
0 commit comments