Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 999 Bytes

no-strict-nullable.md

File metadata and controls

18 lines (13 loc) · 999 Bytes

no-strict-nullable

厳密等価演算子===は有用ですが,undefinednullを右辺に持ってくる時,左辺がundefinedを取りうるのか,それともnullを取りうるのかを考える必要があります. 一方,等価演算子==undefinednullを区別しないため,このような場合に==を使うようにすることで,左辺が取る値を考える必要がなくなります.

このルールでは,右辺がnullまたはundefinedの場合に,厳密等価演算子===を使うことを禁止し,代わりに等価演算子==を使うようにします.

const a = fuga === undefined;
//        ^^^^^^^^^^^^^^^^^^ '=== null'ではなく'== null'を使用してください。
const button = { text: null };
const c = button.text !== null;
//        ^^^^^^^^^^^^^^^^^^^^ '!== null'ではなく'!= null'を使用してください。

リンク

#1513