Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 587 Bytes

no-extra-non-null-assertion.md

File metadata and controls

37 lines (28 loc) · 587 Bytes

Disallow extra non-null assertion (no-extra-non-null-assertion)

Rule Details

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

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

How to use

{
  "@typescript-eslint/no-extra-non-null-assertion": ["error"]
}