Skip to main content

Disallows non-null assertions using the ! postfix operator (no-non-null-assertion)

Rule Details

Using non-null assertions cancels the benefits of the strict null-checking mode.

Examples of code for this rule:

interface Foo {
bar?: string;

const foo: Foo = getFoo();
const includesBaz: boolean =!.includes('baz');

When Not To Use It

If you don't care about strict null-checking, then you will not need this rule.

Further Reading


  • โœ… Recommended
  • ๐Ÿ”ง Fixable
  • ๐Ÿ’ญ Requires type information