-
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
Function argument destructuring and default value generates "syntax" error #201
Comments
Same on me: Module build failed: TypeError: /Users/.../src/components/Formula/index.js: Duplicate declaration "period"
31 | }
32 | }
> 33 | focusVariable = ({ period, field, position }: { period: string, field: string, position: string }) =>
| ^
34 | this.setState({ period, field, position });
35 | render() {
36 | const equalityOperatorIndex = 1; And if remove babel-plugin-flow-runtime it works fine. Some of my deps:
|
It only happened when |
I'm having the same issue:
if I work around the destructuring I get another one in a much weirder place:
the variable 'cache' is the one in this helper (verified by renaming, the error log changes with it): buildCache() {
type Extended = Raw & Helpers;
const cache: { [string]: Extended } = {};
return (_id: string): Promise<Extended> => {
if (cache[_id]) return Promise.resolve(cache[_id]);
return this.findOne({ _id })
.then(doc => {
cache[_id] = doc;
return doc;
});
};
} personally I don't see any commonality between these two cases but maybe it can help someone else figure the issue out as it seems to be related as per the error message. |
Any updates on this? I'm still getting the destructuring error with
|
I just ran into this myself, I will try to debug it. |
Okay commenting out https://github.com/codemix/flow-runtime/blob/master/packages/babel-plugin-flow-runtime/src/preTransformVisitors.js#L13 prevents the error... |
Alright, the problem is that babel has already registered bindings for the function parameters before |
@phpnode I just discovered that the existing test setup can't catch this, because it calls |
fix released in v0.19.0 of babel-plugin-flow-runtime! |
My God! Finally, thank you! |
This is a:
Which concerns:
What is the current behaviour?
flow check --strip-root
) does not complain about thisHowever when I enable
babel-plugin-flow-runtime
and then I start my program I get following error:.babelrc.js:
Without flow-runtime plugin in .babelrc.js it works during runtime (no syntax errors) and also flow does not complain about it during flow check.
What is the expected behaviour?
It should not throw error, this is correct syntax and it's supported by flow.
Which package versions are you using?
The text was updated successfully, but these errors were encountered: