1.01 TypeScript 中的对象

type User = {
	name: string;
	age: number;
};
type Name = User['name'];

上面的示例中,对象类型 User 使用方括号,读取了属性 name 的类型为 string。