# no-non-null-asserted-nullish-coalescing

Rule `typescript/no-non-null-asserted-nullish-coalescing`. Disallow non-null assertions in the left operand of a nullish coalescing operator

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 48.9M weekly downloads of presets that enable it
- Trend: +33.2% last quarter
- Rank: #256 by reach, #1068 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-non-null-asserted-nullish-coalescing` | no | suggestion | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing) |
| Oxlint | `typescript/no-non-null-asserted-nullish-coalescing` | no | safe | plugin `typescript`, category suspicious | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-non-null-asserted-nullish-coalescing.html) |

## Code examples

### Incorrect: the rule reports this

```ts
foo! ?? bar;
foo.baz! ?? bar;
foo!.baz! ?? bar;
foo()! ?? bar;

let x!: string;
x! ?? '';

let x: string;
x = foo();
x! ?? '';
```

### Correct: the rule accepts this

```ts
foo ?? bar;
foo ?? bar!;
foo!.baz ?? bar;
foo!.baz ?? bar!;
foo() ?? bar;

// This is considered correct code because there's no way for the user to satisfy it.
let x: string;
x! ?? '';
```

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-asserted-nullish-coalescing": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/no-non-null-asserted-nullish-coalescing": "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% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [typescript/return-await](https://lintradar.dev/rules/typescript/return-await.md): Enforce consistent awaiting of returned promises
- [typescript/unified-signatures](https://lintradar.dev/rules/typescript/unified-signatures.md): Disallow two overloads that could be unified into one with a union or an optional/rest parameter
- [typescript/no-dynamic-delete](https://lintradar.dev/rules/typescript/no-dynamic-delete.md): Disallow using the `delete` operator on computed key expressions
- [typescript/consistent-type-definitions](https://lintradar.dev/rules/typescript/consistent-type-definitions.md): Enforce type definitions to consistently use either `interface` or `type`
- [typescript/no-inferrable-types](https://lintradar.dev/rules/typescript/no-inferrable-types.md): Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
- [typescript/consistent-type-assertions](https://lintradar.dev/rules/typescript/consistent-type-assertions.md): Enforce consistent usage of type assertions

---

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