generated at
2/18/2025, 11:20:04 AM
TypeScriptのnull判定
nullとundefinedを両方除外したいときは、
hoge==null
で判定できる
ref
undefined
は使わないようにする
https://typescript-jp.gitbook.io/deep-dive/recap/null-undefined#undefinedwowanaiyounisuru
★
https://typescript-jp.gitbook.io/deep-dive/recap/null-undefined#validitynodeundefinedwoshinai
redux-formのvalidationのときかバンバン使ってるな....
!!
でtruthy,falsyな値をbooleanに変換
配列の中身がnull
v
の中身が
[undefined]
のとき
v===[undefined]
はtrueにならない
v
の中身が
[null]
のとき
v===[null]
はtrueにならない
このとき
v[0]==[null]
で両方いける