Open 981377660LMT opened 1 year ago
const person = { firstName: 'George', lastName: 'Costanza', fullName: `${person.firstName} ${person.lastName}` }; 错误 TS2448:在声明之前使用块范围变量“person”。 const person = { firstName: 'George', lastName: 'Costanza', get fullName() { return `${person.firstName} ${person.lastName}`; } }; console.log(JSON.stringify(person));