Is it possible to modify the inferred type of a literal in TypeScript?

前端 未结 0 1632
暖寄归人
暖寄归人 2020-12-14 13:27

Consider the following code that tries to conditionally add a property to an object with an inferred type:

const foo = {
    a: 1,
    b: 2,
};

if (bar) {
           


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