# noMisleadingReturnType

Rule `biome/noMisleadingReturnType`. Detect return type annotations that are misleadingly wider than what the implementation actually returns.

- Source: biome
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1912 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/noMisleadingReturnType` | no | no | group nursery, since 2.4.11 | [docs](https://biomejs.dev/linter/rules/no-misleading-return-type/) |

## Code examples

### Incorrect: the rule reports this

```ts
function getStatus(b: boolean): string { if (b) return "loading"; return "idle"; }
```

```ts
function getCode(ok: boolean): number { if (ok) return 200; return 404; }
```

```ts
class Foo { getStatus(b: boolean): string { if (b) return "loading"; return "idle"; } }
```

### Correct: the rule accepts this

```ts
function getStatus() { return "loading"; }
```

```ts
function run(): void { return; }
```

```ts
class Foo { greet(): string { return "hello"; } }
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noMisleadingReturnType": "error"
      }
    }
  }
}
```

## Related rules

- [biome/noJsxLeakedDollar](https://lintradar.dev/rules/biome/noJsxLeakedDollar.md): Flags text nodes with a trailing `$` before a JSX expression.
- [biome/noMissingScssInterpolation](https://lintradar.dev/rules/biome/noMissingScssInterpolation.md): Disallow Sass variables and function calls in custom property values without `#{}` interpolation.
- [biome/noInlineStyles](https://lintradar.dev/rules/biome/noInlineStyles.md): Disallow the use of inline styles.
- [biome/noNamespaceImport](https://lintradar.dev/rules/biome/noNamespaceImport.md): Disallow the use of namespace imports.
- [biome/noHexColors](https://lintradar.dev/rules/biome/noHexColors.md): Disallow hex colors.
- [biome/noNestedComponentDefinitions](https://lintradar.dev/rules/biome/noNestedComponentDefinitions.md): Disallows defining React components inside other components.

---

Web page: https://lintradar.dev/rules/biome/noMisleadingReturnType. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
