📌  相关文章
📜  对象可能是 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:32.259000             🧑  作者: Mango

代码示例1
const response = await fetchTodos();
console.log(response.data) // object is possibly undefined
// optional chaining
console.log(response?.data) 
// simple null check
if (response && response.data) console.log(response.data)