An error occurs in typescript when Optional Chaining is specified as a variable

前端 未结 0 960
故里飘歌
故里飘歌 2021-01-17 16:08

I encountered the following error when I wrote code using \'Optional Changing\'.

type Foo = {
  b?: number
}

const foo:Foo = {}

if (foo?.b) {
  console.log(         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题