-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type spread on imported types doesn't work #230
Comments
any work around for this? |
If anyone contributes a fix, I will make sure it gets released. |
I might look into this soon if I have time...
I don't think type stripping would cause any problems like this? Because flow-runtime converts all type imports/exports to runtime values. If types get stripped before I forget the specifics of how presets interact with plugin order, but in my {
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
[
'babel-plugin-flow-runtime',
{ assert: false, annotate: false, optInOnly: true },
],
'@babel/plugin-proposal-async-generator-functions',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-flow-strip-types',
['@babel/plugin-proposal-class-properties', { loose: true }],
'babel-plugin-lodash',
'babel-plugin-dedent',
'@babel/plugin-transform-runtime',
],
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-react',
'@babel/preset-flow',
]
} |
This is a:
Which concerns:
What is the current behaviour?
Example:
If a
type
is imported from external file and spread into anothertype
the following error is thrown:TypeError: Invalid attempt to spread non-iterable instance
.It seems like that at this point the
@babel/flow
preset already stripped out the types so it tries to spreadundefined
.But if both types are declared in the same file everything works fine.
To showcase this bug I created a minimal reproducible example over here: https://github.com/risetechnologies/flow-runtime-bug
What is the expected behaviour?
It should be possible to spread a type from external file into another type.
Which package versions are you using?
The text was updated successfully, but these errors were encountered: