> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

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

[Added in v0.2.1](https://github.com/web-infra-dev/rslint/releases/tag/v0.2.1)
## Configuration

| Preset                         | Configured Value |
| ------------------------------ | ---------------- |
| ✅ ts.configs.strict            | `"error"`        |
| ✅ ts.configs.strictTypeChecked | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
    },
  },
]);
```

## Rule Details

Disallow non-null assertions in the left operand of a nullish coalescing operator.

The `??` nullish coalescing operator is designed to provide a default value when dealing with `null` or `undefined`. Using a non-null assertion `!` in the left operand is contradictory and likely a mistake.

Examples of **incorrect** code for this rule:

```typescript
foo! ?? bar;
foo.bazz! ?? bar;
foo()! ?? bar;
```

Examples of **correct** code for this rule:

```typescript
foo ?? bar;
foo ?? bar!;
foo.bazz ?? bar;
```

## Original Documentation

- [typescript-eslint: no-non-null-asserted-nullish-coalescing](https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-non-null-asserted-nullish-coalescing.ts)
