Skip to main content

no-extra-non-null-assertion

Disallows extra non-null assertion.

Attributes

  • Included in configs
    • ✅ Recommended
    • 🔒 Strict
  • Fixable
    • 🔧 Automated Fixer
    • 🛠 Suggestion Fixer
  • 💭 Requires type information

Rule Details

Examples of code for this rule:

const foo: { bar: number } | null = null;
const bar = foo!!!.bar;
function foo(bar: number | undefined) {
const bar: number = bar!!!;
}
function foo(bar?: { n: number }) {
return bar!?.n;
}

Options

// .eslintrc.json
{
"rules": {
"@typescript-eslint/no-extra-non-null-assertion": "error"
}
}

This rule is not configurable.