【发布时间】:2019-12-15 23:29:17
【问题描述】:
在流类型中:
export type GroupType = {
options: OptionsType,
[string]: any,
};
[string]: any 是什么意思?
编辑:
感谢您的回复。
我该如何理解这段代码?
import type { GroupType } from './types';
const formatGroupLabel = (group: GroupType): string => group.label;
对我来说formatGroupLabel 是一个以group 为参数并返回group.label 的函数。但是我不明白为什么(group: GroupType)前面有: string。可能与我的第一个问题没有链接。
【问题讨论】:
-
更新了我的答案,但我认为这应该是一个不同的问题。
标签: javascript typescript types flowtype