与 Required 相反,将所有属性转换为可选属性
interface Person {
name: string,
age: number,
}
const shuge:Person = {
name:'树哥'
} // error Property 'age' is missing in type '{ name: string; }' but required in type 'Person'.
type User = Partial<Person>
const shuge: User={
name:'树哥'
} // 编译正确