在CommonJS中导出流类型? [英] Exporting Flow type in CommonJS?

查看:90
本文介绍了在CommonJS中导出流类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以类似于类似于ES6类型的导入/导出

推荐答案

没有CommonJS风格的需要用于Flow,但是Flow的导入类型 / 导出类型语法可以与CommonJS require 调用一起使用。

There is no CommonJS-style require for Flow, but Flow's import type/export type syntax can be used alongside CommonJS require calls.

尽管语法看起来很相似,但导入类型导出类型不是实际的JavaScript import / export 语句。必须先从代码中删除它们,然后才能在当前浏览器中运行代码。例如,如果您使用Babel编译代码,请使用 transform-flow -strip-types 插件剥离流类型并输入/导出类型。

Though the syntax looks similar, import type and export type are not actual JavaScript import/export statements. They must be stripped from your code before your code can be run in current browsers. If you use Babel to compile your code, for example, you use the transform-flow-strip-types plugin to strip Flow types and type imports/exports.

这篇关于在CommonJS中导出流类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆