Skip to content
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

[4.2.0] Spread operator error no 'Object.assign' #215

Closed
rcline opened this issue Nov 4, 2016 · 5 comments
Closed

[4.2.0] Spread operator error no 'Object.assign' #215

rcline opened this issue Nov 4, 2016 · 5 comments

Comments

@rcline
Copy link
Contributor

rcline commented Nov 4, 2016

When upgrading from v4.1.0 to v4.2.0 I am getting this error:

CompileError: Mixed JSX attributes ending in spread requires specified objectAssign option with 'Object.assign' or polyfill helper. (10:2)
6  :   }
7  : };
8  : 
9  : <div>
10 :   <Button {...props} displaySize="large">Large Primary</Button>
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In my Readme.md component example I am setting up a variable and then using the spread operator like so:

const props = {
  kind: 'default',
  onClick: () => console.log('Button clicked'),
  style: {
    marginRight: '10px'
  }
};

<div>
  <Button {...props} displaySize="large">Large Default</Button>
  <Button {...props} displaySize="medium">Medium Default</Button>
  <Button {...props} displaySize="small">Small Default</Button>
</div>

This separates out the styling used just for the style guide and common props for ease of use and editing inside the running styleguide app.

I looked through commit history between the two version, the only thing standing out is the switch between babel-standalone and buble. I will look into buble some more, but do I need to include my own Object.assign polyfill now?

Much thanks, love this library!!!

@rcline rcline changed the title [Upgrading from 4.1.0 to 4.2.0] [4.2.0] Spread operator error no 'Object.assign' Nov 4, 2016
@sapegin
Copy link
Member

sapegin commented Nov 4, 2016

I’m almost sure that’s because of the switch to Buble. If you have time to find how to do that and send a pull request (if it can be done in Styleguidist itself) that would be awesome ;-)

@nkt
Copy link
Contributor

nkt commented Nov 7, 2016

@sapegin please add flag which would replace buble by babel.
In my project I got following error:

Error when parsing src/components/AuthForm/AuthForm.js
Error: [{type: ImportSpecifier, start: 270, end: 282, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 284, end: 294, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 298, end: 312, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 314, end: 323, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 327, end: 341, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 343, end: 352, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}, {type: ImportSpecifier, start: 356, end: 369, loc: [object Object], imported: [object Object], local: [object Object], id: null, name: null}] does not match type Printable

@sapegin
Copy link
Member

sapegin commented Nov 7, 2016

@nkt Could you please share your example source? I don’t think there’s a real need for extra complexity.

@nkt
Copy link
Contributor

nkt commented Nov 7, 2016

@sapegin

git clone https://github.com/dialogs/dialog-web-components.git
git checkout v0.54.3
yarn install
styleguidist build

@sapegin
Copy link
Member

sapegin commented Nov 7, 2016

@nkt Awesome styleguide!! ❤️

This error is from react-docgen. We use Buble only for client-side rendering of examples in Markdown, not for your components code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants