小编Ste*_*ans的帖子

打字稿记录项目计数

是否可以在 Typescript 记录中找到项目数?

例如类似的东西

const testRecord: Record<string, string> = {
  'one': 'value1',
  'two': 'value2'
};

var length = testRecord.length;

// looking for length to be 2 but is undefined as there is no length property
Run Code Online (Sandbox Code Playgroud)

供参考:https : //www.typescriptlang.org/docs/handbook/utility-types.html#recordkt

typescript-generics typescript2.0

5
推荐指数
1
解决办法
3390
查看次数

标签 统计

typescript-generics ×1

typescript2.0 ×1