React/TypeScript - Connecting components to Zeplin components failed.

Open
#441 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
react, typescript

Research direction

Start by reproducing the connection failure with src/components/atoms/Button/Button.tsx, the shown config, and the listed @zeplin CLI package versions. Read the plugin’s dist/template/base.pug around line 18 and inspect the component metadata reaching it; done means the Zeplin connection completes without the undefined propType error.

Written by the indexing model from the issue text.

Description

typescript

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",
Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
3h 28m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reactjs/react-docgen

All issues in reactjs/react-docgen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.