reactjs / react-docgen

A CLI and library to extract information from React component files for documentation generation purposes.
https://react-docgen.dev
MIT License
3.67k stars 296 forks source link

React/TypeScript - Connecting components to Zeplin components failed. #441

Open DigiDigiblez opened 4 years ago

DigiDigiblez commented 4 years ago

Seems like I am having issues with ES6 imports, or TypeScript itself?

import React from "react";
import cls from "classnames";
import { IButtonProps } from "./types";
import "./Button.scss";

const baseclass = "button";

const Button = ({
    ...,
}: IButtonProps) => {
    const classes = cls(
        baseclass,
        className,
       ...,
    );

    return (
        <button
            disabled={disabled}
            className={classes}
            type={type}
            onClick={onClick}>
            {children}
        </button>
    );
};

export default Button;

Results in following output issue:

Connecting components to Zeplin components failed.

    Error occurred while processing src/components/atoms/Button/Button.tsx with @zeplin/cli-connect-react-plugin:

    /Users/carlbowen/WebstormProjects/note/node_modules/@zeplin/cli-connect-react-plugin/dist/template/base.pug:18
        16| 
        17| mixin propType(name, propType)
      > 18|     if propType.name === "union"
        19|         |   #{name}={union[
        20|         +propertyValues(propType.value)
        21|         | }]

    Cannot read property 'name' of undefined

My config file is as follows:

{
    "plugins": [
        {
            "name": "@zeplin/cli-connect-react-plugin"
        }
    ],
    "projects": [],
    "styleguides": [
        "5cd486b18a..."
    ],
    "components": [
        {
            "path": "src/components/atoms/Button/Button.tsx",
            "zeplinNames": [
                "Full Logo"
            ]
        }
    ]
}

API versions in use:

"@zeplin/cli": "^1.0.0",
"@zeplin/cli-connect-react-plugin": "^0.2.3",
blancomario commented 4 years ago

I am also having the same issue.

- @zeplin/cli@1.0.0
 - @zeplin/cli-connect-react-plugin@0.2.3
 - @zeplin/cli-connect-storybook-plugin@0.1.4
jacobdo2 commented 4 years ago

Have you guys found any way out of this? Or what exactly is causing the issue?

DigiDigiblez commented 4 years ago

@jacobdo2 not yet sadly. Wish we could prioritise this ticket.

alphanumericone commented 4 years ago

This may have been resolved today in @zeplin/cli-connect-react-plugin@0.2.4