ts/js 获取已知对象的所有key

const A = {
  a: 1,
  b: 2
}

keyof typeof A; // 'a' | 'b'

posted @ 2021-07-14 11:44  Mr_Kahn  阅读(2094)  评论(0)    收藏  举报