繁体   English   中英

Flow 的 libdefs 中 $Export 变量的含义是什么?

[英]What is the meaning of $Export variable in Flow's libdefs?

我正在使用流类型。

我在某些libdefs 中遇到了变量$Export 我不知道它是什么以及它记录在哪里。

对我来说,它似乎类似于Utility Types ,但是$Export没有在那里描述的问题。 任何机构都可以解释它以及它的来源吗?

declare module "@material-ui/core/AppBar/AppBar" {
  import type {ComponentType, Node} from "react";

  declare type Color = "inherit" | "primary" | "secondary" | "default";
  declare type Position = "fixed" | "absolute" | "sticky" | "static" | "relative";

  declare module.exports: ComponentType<{
    children?: Node,
    className?: string,
    classes?: Object,
    color?: Color,
    position?: Position
  }>;
}

declare module "@material-ui/core/AppBar" {
  declare module.exports: $Exports<"@material-ui/core/AppBar/AppBar">;
}

看看这个 Github 线程,它们似乎是内部方法

定义似乎在这里:

https://github.com/facebook/flow/blob/master/src/typing/type_annotation.ml#L491

哪里有这个评论:

(*  $Exports<'M'> is the type of the exports of module 'M'

所以它基本上是一个用于所有意图和目的的模块加载器,直到 TODO 列表中的项目到达

 (** TODO: use `import typeof` instead when that lands **)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM