Skip to main content

类型层次结构

Flow 中的类型形成基于 subtyping 的层次结构:

¥Types in Flow form a hierarchy based on subtyping:

单击某个节点即可转到该类型的文档。

¥Click on a node to go to the documentation for that type.

在此图中出现较高的类型更一般,而出现较低的类型则更具体。从类型 A 指向类型 B 的箭头表示 AB 的子类型。例如,类型 string?string 的子类型。

¥Types appearing higher in this graph are more general, while those appearing lower are more specific. An arrow pointing from type A to type B means that A is a subtype of B. For example, the type string is a subtype of ?string.

any 怎么可能同时处于顶部和底部呢?因为 这是不安全的。这用虚线表示。

¥How can any be at both the top and the bottom? Because it is unsafe. This is denoted with a dotted line.