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 = foo.bar!.includes('baz');
interface Foo {
bar?: string;
}
const foo: Foo = getFoo();
const includesBaz: boolean = foo.bar?.includes('baz') ?? false;
If you don't care about strict null-checking, then you will not need this rule.
- ✅ Recommended
- 🔧 Fixable
- 💭 Requires type information