{"version":"1.0","categories":["TypeScript"],"published":"2020-06-14 12:00:00","blog_url":"https://www.pandanoir.info/","provider_url":"https://hatena.blog","type":"rich","author_name":"panda_noir","width":"100%","image_url":null,"url":"https://www.pandanoir.info/entry/2020/06/14/120000","title":"TypeScript\u3067\u914d\u5217\u304b\u3089null\u3092\u53d6\u308a\u9664\u304f","provider_name":"Hatena Blog","blog_title":"Panda Noir","description":"\u7d50\u8ad6 const a = [1, 2, 3, null]; // null\u3068undefined\u3092\u306f\u3058\u304f const filtered = a.filter(<T>(n: T): n is NonNullable<T> => n != null); // null\u3060\u3051\u306f\u3058\u304f const filtered2 = a.filter(<T>(n: T): n is Exclude<T, null> => n !== null); null\u3092\u9664\u3044\u305f\u914d\u5217\u306e\u578b null\u3092\u8a31\u5bb9\u3059\u308b\u914d\u5217\u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002\u3053\u306e\u914d\u5217\u306bfilter\u3092\u304b\u3051\u3066null\u3092\u306f\u3058\u304f\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002 const a = [1, 2\u2026","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.pandanoir.info%2Fentry%2F2020%2F06%2F14%2F120000\" title=\"TypeScript\u3067\u914d\u5217\u304b\u3089null\u3092\u53d6\u308a\u9664\u304f - Panda Noir\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","author_url":"https://blog.hatena.ne.jp/panda_noir/"}