流程:指定对象的键和值的类型
Flow: Specify type of the keys and values of an object
我想为 headers
对象创建一个类型,我知道其中的键将是 strings
,值也是。我可以创建一个类型来指定该对象的键和值的类型吗?
export type Options = {|
+headers?: Object,
|};
干杯,
在JavaScript中,对象的键或属性总是字符串或符号类型。所以不需要指定键的类型。
我想为 headers
对象创建一个类型,我知道其中的键将是 strings
,值也是。我可以创建一个类型来指定该对象的键和值的类型吗?
export type Options = {|
+headers?: Object,
|};
干杯,
在JavaScript中,对象的键或属性总是字符串或符号类型。所以不需要指定键的类型。