Inspectopedia Help

Unreachable 'case' branch of a 'switch' statement

Reports an unreachable case branch of a switch statement.

Example:

/** * @param {('foo' | 'bar')} p */ function foo(p) { switch (p) { case 'foo': break; case 'bar': break; case 'baz': break; // unreachable } }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

JSUnreachableSwitchBranches
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | JavaScript and TypeScript | Switch statement issues

Inspection options

Here you can find the description of settings available for the Unreachable 'case' branch of a 'switch' statement inspection, and the reference of their default values.

Don't show this warning in the context of a dynamic type

Default: Selected

Last modified: 11 September 2024