如何在没有它的情况下使用流接口抱怨“接口”是严格模式下的未来保留字?

时间:2017-07-03 11:24:24

标签: flowtype

我正在使用flow来创建一个我想要一些类来实现的接口:

// @flow

export default interface Client {
  connect(): any;
  getFile(): any;
  uploadFile(): any;
  deleteFile(): any;
  end(): any;
};

但是当我运行flow check时,我收到以下错误:

3: export default interface Client {
                  ^^^^^^^^^ Use of future reserved word in strict mode

我正在关注Flow文档的Interfaces typesModules types页面,我没有找到解决问题的方法。

我的流量版本是0.49.1。

有没有人有使用接口的解决方案?非常感谢你。

1 个答案:

答案 0 :(得分:4)

您似乎无法将其设为默认导出。通过了:

/* @flow */

export interface Client {
  connect(): any;
  getFile(): any;
  uploadFile(): any;
  deleteFile(): any;
  end(): any;
};

我不确定Flow是否支持将任何类型设为默认导出。我从来没有做过,从来没有觉得有必要尝试。