Is it possible to export and import Flow type definitions in CommonJS world similarly to ES6 like type imports/exports?
There is no CommonJS-style require
for Flow, but Flow's import type
/export type
syntax can be used alongside CommonJS require
calls.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With