deno.com

no-non-null-asserted-optional-chain

禁止在可选链表达式后使用非空断言。

?. 可选链表达式在对象为 nullundefined 时返回 undefined。使用 ! 非空断言来断言 ?. 可选链表达式的结果为非空值很可能是错误的。

无效示例:

foo?.bar!;
foo?.bar()!;

有效示例:

foo?.bar;
foo?.bar();

你找到需要的内容了吗?

隐私政策