【问题标题】:What is the meaning of $Export variable in Flow's libdefs?Flow 的 libdefs 中的 $Export 变量是什么意思?
【发布时间】:2019-08-23 15:29:59
【问题描述】:

我使用的是流式。

我在一些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">;
}

【问题讨论】:

    标签: javascript flowtype flow-typed


    【解决方案1】:

    this Github thread好像是内部方法

    定义好像在这里:

    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 **)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-30
      • 2019-12-26
      • 1970-01-01
      • 2011-08-30
      • 2022-01-25
      • 1970-01-01
      • 2010-12-04
      相关资源
      最近更新 更多