【发布时间】:2021-08-02 09:32:21
【问题描述】:
下面的代码抛出Spread types may only be created from object types:
const bool = true
console.log({ ...(bool || { foo: 'bar' }) })
虽然以下工作正常,但导致上述错误的原因以及如何抑制它?
const bool = true
console.log({ ...(bool && { foo: 'bar' }) })
【问题讨论】:
标签: typescript typescript-typings