Top level exports
StefanoBalocco opened this issue · 1 comments
StefanoBalocco commented
I'm trying to convert some typescript code to flow but there is a part that seems invalid in flow:
class foo {
bar() {
}
}
if( typeof exports === 'object' ) {
exports.foo = foo;
}
Flow version: 0.232
Expected behavior
No error
Actual behavior
Exports can only appear at the top level [invalid-export]
SamChou19815 commented
TypeScript probably shouldn't accept this code, since it's too dynamic to analyze the signature of the module.
I think in this case, TS might think that the code is a script rather than a module, so it has more relaxed checks.