Squ*_*ler 2 typescript flowtype
Flow 具有方便的$Keys实用功能,可以从对象中提取键并创建字符串文字的联合。所以你可以这样做:
const foo = {
input: Input,
button: Button,
select: Select
}
type FormType = $Keys<typeof foo> // FormType now is: 'input' | 'button' | 'select'
Run Code Online (Sandbox Code Playgroud)
Typescript 是否具有等效功能?我知道,keyof但是interface当 Flow 可以获取对象的键时,它只能获取 的键。
| 归档时间: |
|
| 查看次数: |
870 次 |
| 最近记录: |