> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# switch-not-exhaustive

> A switch over a union or enum has no default and misses members, so the missing value leaves the result undefined.

## What it flags

A `switch` over a union of string or number literals, or an enum, names only some members and has no `default`, and the function then returns nothing for the rest or a variable declared without a value is read afterwards.

For an unexported top-level `function` declaration in a module, direct calls can narrow the members that reach the switch. The switch must test a parameter or a statically named property supplied by an object-literal argument. Arrow functions, methods, nested or exported functions, and functions with indirect callers use the type at the switch. A `for...of` loop over a `const` array of literals typed `readonly` supplies those literals when the array is unexported and used nowhere else in the same file, or imported from another module.

A function whose declared return type admits `undefined` or `void`, such as `string | undefined`, may fall off the end on purpose, and an unset variable rendered only as a JSX child (`<p>{note}</p>`) renders nothing; neither is reported.

## How to review or fix

Add the missing cases, or a `default` that throws.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "switch-not-exhaustive": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.