在CommonJS中导出流类型? [英] Exporting Flow type in 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屋!