---
title: "lint/types/prefer-narrow-param-type"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/types/prefer-narrow-param-type" />

In the [`types`](/docs/rules/sets/types) set. Unsafe fix: it can change behaviour.

## What it does

Narrow an already nullable array_any()/array_all()/array_find()/array_find_key() closure param to the non-nullable array item type

## Configuration

```toml title="pun.toml"
[lint.rules]
"types/prefer-narrow-param-type" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`NarrowArrayAnyAllNullableParamType`](https://getrector.com/rule-detail/narrow-array-any-all-nullable-param-type-rector) (rector)

[More lint/types rules](/docs/rules/lint/types) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
