TypeScript part4 (378レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

277: デフォルトの名無しさん [sage] 2023/11/18(土) 23:58:12.41 ID:4VZDo/pg(1) AAS
strictNullChecksを有効にするとこのコードがエラーになる

const foo: { bar: string } | null = { bar: 'bar' };
if (false) if (foo !== null) console.log(foo.bar); // error TS18047: 'foo' is possibly 'null'.

falseを!trueに変えるとエラーにならない

if (!true) if (foo !== null) console.log(foo.bar);

どういうこっちゃ
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.980s*