type Foo = { [key: number]: string } const foo: Foo = { 100: 'foo', 200: 'bar' } const sizes: number[] = Object.keys(foo)
得到的错误信息为:
类型“string[]”不能赋给类型“number[]”
为什么Typescript会假设是string[]?在这里创建一个数字数组的正确方式是什么?
string[]
用户名或邮箱地址
密码