# no-non-null-assertion

Rule `typescript/no-non-null-assertion`. Disallow non-null assertions using the `!` postfix operator

- Source: typescript
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 74.7M weekly downloads of presets that enable it
- Trend: +53.4% last quarter
- Rank: #232 by reach, #745 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-non-null-assertion` | no | suggestion | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-non-null-assertion) |
| Oxlint | `typescript/no-non-null-assertion` | no | no | plugin `typescript`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-non-null-assertion.html) |
| Biome | `style/noNonNullAssertion` | yes | unsafe | group style, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-non-null-assertion/) |

## Code examples

### Incorrect: the rule reports this

```ts
interface Example {
  property?: string;
}

declare const example: Example;
const includesBaz = example.property!.includes('baz');
```

### Correct: the rule accepts this

```ts
interface Example {
  property?: string;
}

declare const example: Example;
const includesBaz = example.property?.includes('baz') ?? false;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/no-non-null-assertion": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/no-non-null-assertion": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noNonNullAssertion": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [typescript-eslint strict](https://lintradar.dev/presets/typescript-eslint-strict.md) | ESLint | `@typescript-eslint/eslint-plugin` | 32 | 175.9M | +29.5% |
| [typescript-eslint strict type-checked](https://lintradar.dev/presets/typescript-eslint-strict-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 75 | 175.9M | +29.5% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [typescript/no-unnecessary-type-assertion](https://lintradar.dev/rules/typescript/no-unnecessary-type-assertion.md): Disallow type assertions that do not change the type of an expression
- [typescript/no-misused-promises](https://lintradar.dev/rules/typescript/no-misused-promises.md): Disallow Promises in places not designed to handle them
- [typescript/prefer-function-type](https://lintradar.dev/rules/typescript/prefer-function-type.md): Enforce using function types instead of interfaces with call signatures
- [typescript/adjacent-overload-signatures](https://lintradar.dev/rules/typescript/adjacent-overload-signatures.md): Require that function overload signatures be consecutive
- [typescript/no-invalid-void-type](https://lintradar.dev/rules/typescript/no-invalid-void-type.md): Disallow `void` type outside of generic or return types
- [typescript/no-extraneous-class](https://lintradar.dev/rules/typescript/no-extraneous-class.md): Disallow classes used as namespaces

---

Web page: https://lintradar.dev/rules/typescript/no-non-null-assertion. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
