【发布时间】:2018-06-08 23:48:34
【问题描述】:
我正在努力将库 (Relay) 附带的 Flow 类型生成器移植到发出 TypeScript 类型的库中,但对 this snippet 中对我来说并不明显的一些 Flow 语法有一些疑问:
import type { FragmentReference } from 'relay-runtime';
export opaque type TypenameInside$ref: FragmentReference = FragmentReference;
export type TypenameInside = ({|
+__typename: 'User',
+firstName: ?string,
+$refType: TypenameInside$ref,
|} | {|
+__typename: 'Page',
+username: ?string,
+$refType: TypenameInside$ref,
|} | {|
// This will never be '%other', but we need some
// value in case none of the concrete values match.
+__typename: '%other',
+$refType: TypenameInside$ref,
|});
即$ref、$refType和%other是什么?或者它们不是特定于流的,而是特定于中继的?
我尝试搜索 flowtype 文档和 repo,但很难找到答案。链接到文档和/或实现的相关部分也将不胜感激。
【问题讨论】:
-
@halfer 完成,感谢提醒????