---
title: "unreachable-type-switch-case"
description: "Detect type-switch cases hidden by earlier interfaces."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# unreachable-type-switch-case

**Default severity:** `warning`

Type-switch cases are evaluated in source order. A later concrete type or
narrower interface is unreachable when it necessarily implements an interface
listed by an earlier case.

## Bad

```go
switch value.(type) { case io.Reader: use(); case io.ReadCloser: use() }
```

## Good

```go
switch value.(type) { case io.ReadCloser: use(); case io.Reader: use() }
```

Source: https://strider.gempir.com/analyzers/unreachable-type-switch-case/index.mdx
