diff options
| author | Richie Foreman <[email protected]> | 2025-08-13 18:59:46 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-13 22:59:46 +0000 |
| commit | 514e883af17cbfe5f1de7c2b92c08a5f5a3a8fad (patch) | |
| tree | 9b5fcc36c820fb5d30f4bfccfa120a991c9edfc1 | |
| parent | d6f74ea2f0a422c86daea2a06284e497db082a16 (diff) | |
chore(gemini.md): Make the checkExhaustive helper section more brief/direct (#6181)
| -rw-r--r-- | GEMINI.md | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -117,25 +117,12 @@ TypeScript's power lies in its ability to provide static type checking, catching ### Type narrowing `switch` clauses -When authoring a switch clause over an enumeration or fixed list of items, -always prefer to use the `checkExhaustive` helper method within the default -clause of the switch. This will ensure that all of the possible options within -the value or enumeration are used. +Use the `checkExhaustive` helper in the default clause of a switch statement. +This will ensure that all of the possible options within the value or +enumeration are used. This helper method can be found in `packages/cli/src/utils/checks.ts` -Here's an example of using the helper method properly: - -``` -switch (someValue) { - case 1: - case 2: - // ... - default: - return checkExhaustive(someValue); -} -``` - ### Embracing JavaScript's Array Operators To further enhance code cleanliness and promote safe functional programming practices, leverage JavaScript's rich set of array operators as much as possible. Methods like `.map()`, `.filter()`, `.reduce()`, `.slice()`, `.sort()`, and others are incredibly powerful for transforming and manipulating data collections in an immutable and declarative way. |
