Closed elado closed 8 years ago
Fixed in 3.7.0
I'm using 3.8.0 and see the following compiling error:
Property argument of UnaryExpression expected node to be of a type ["Expression"] but instead got "AssignmentPattern"
for the following code:
const FormattedDuration = ({ duration, specifier = ',d' }: {
duration: number,
specifier: string
}) => {...}
Having it written like:
type Props = {
duration: number,
specifier: string,
svg: ?boolean
}
const FormattedDuration = ({ duration, specifier = ',d', svg = false }: Props) => {...}
shows me
ERROR in ./app/components/FormattedDuration/FormattedDuration.js
Module parse failed: [...]/node_modules/babel-loader/index.js?{"presets":["react-hmre"],"plugins":["babel-plugin-typecheck"]}!/.../app/components/FormattedDuration/FormattedDuration.js Shorthand property assignments are valid only in destructuring patterns (29:47)
You may need an appropriate loader to handle this file type.
| var svg = _arg$svg === undefined ? false : _arg$svg;
|
| if (!Props({ duration: duration, specifier = ',d', svg = false })) {
| throw new TypeError('Value of "{\n duration,\n specifier = \',d\',\n svg = false\n}" violates contract.\n\nExpected:\nProps\n\nGot:\n' + _inspect({ duration: duration, specifier = ',d', svg = false }));
| }
Any news on this? I’m getting the same error as @okonet when using param destructuring
Error:
SyntaxError: Unexpected token =