instanceof Date === true似乎不满足TypeScript 3.4.5的基于控制流的类型分析。在下面的代码中,TypeScript会抱怨我返回的值不是日期,即使在我检查它确实是日期之后也是如此。browser.storage.local.get({testDate: new Date()});
// typescripttestDate;
假设,如果我有以下函数: function nullOrString(): string | null {} 这不会产生任何错误: const value = nullOrStringnot assignable to type 'string'. if (nullOrString()) {} 是我误解了函数,还是这是一个TypeScript错误?