55. 实现 ObjectEntries

中等0

实现 TypeScript 版本的 Object.entries ,即将对象中的属性和对应类型组成一个数组,返回一个包含了所有这些组合的联合类型。

例如:

interface Model {
  name: string;
  age: number;
  locations: string[] | null;
}
type modelEntries = ObjectEntries<Model> // expected to be ['name', string] | ['age', number] | ['locations', string[] | null]
评论(0)
题库

TypeScript

加载中...