📅  最后修改于: 2022-03-11 14:55:56.530000             🧑  作者: Mango
interface User { name: string; id: number;}
const user: User = { username: "Hayes",Type '{ username: string; id: number; }' is not assignable to type 'User'.
Object literal may only specify known properties, and 'username' does not exist in type 'User'.2322Type '{ username: string; id: number; }' is not assignable to type 'User'.
Object literal may only specify known properties, and 'username' does not exist in type 'User'. id: 0,};Try