省略号在 Flow 类型声明中起什么作用?
What do the ellipsis do in Flow type declarations?
以下Flow代码中的省略号是什么,它们有什么作用?
export type ListTypeNode = {
+kind: 'ListType',
+loc?: Location,
+type: TypeNode,
...
};
这是 Flow 中的新语法,将来会指示此对象类型是不精确的(当常规注释默认为精确对象注释时)。
In a few releases, Flow will begin to treat {foo: number} as an exact object. To indicate inexactness, you must add an ellipsis to the end of an object type: {foo: number, ...}. This new syntax forces the developers to opt into inexactness.
在此处查看更多详细信息:https://medium.com/flow-type/on-the-roadmap-exact-objects-by-default-16b72933c5cf
以下Flow代码中的省略号是什么,它们有什么作用?
export type ListTypeNode = {
+kind: 'ListType',
+loc?: Location,
+type: TypeNode,
...
};
这是 Flow 中的新语法,将来会指示此对象类型是不精确的(当常规注释默认为精确对象注释时)。
In a few releases, Flow will begin to treat {foo: number} as an exact object. To indicate inexactness, you must add an ellipsis to the end of an object type: {foo: number, ...}. This new syntax forces the developers to opt into inexactness.
在此处查看更多详细信息:https://medium.com/flow-type/on-the-roadmap-exact-objects-by-default-16b72933c5cf