Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Default classes without name are failing #350

Closed
KnisterPeter opened this issue Apr 3, 2017 · 0 comments
Closed

Default classes without name are failing #350

KnisterPeter opened this issue Apr 3, 2017 · 0 comments
Labels

Comments

@KnisterPeter
Copy link
Owner

This component fails with

import {createElement, Component, PropTypes} from 'react';

export default class extends Component {

    static propTypes = {
        onClick: PropTypes.func
    };

    render() {
        var children = props.children || 'Button';
        var onClick = props.onClick || (() => undefined);
        return (
            <button className="button" onClick={onClick}>
                {children}
            </button>
        );
    }
}
patternlib_1  | > node ./bin/create-typings
patternlib_1  | 
patternlib_1  | /patternplate/bin/create-typings.js:18
patternlib_1  | 			throw err;
patternlib_1  | 			^
patternlib_1  | 
patternlib_1  | TypeError: Cannot read property 'name' of null
patternlib_1  |     at /patternplate/node_modules/react-to-typescript-definitions/dist/src/typings.js:210:58
patternlib_1  |     at Array.map (native)
patternlib_1  |     at getComponentNamesByStaticPropTypeAttribute (/patternplate/node_modules/react-to-typescript-definitions/dist/src/typings.js:210:20)
patternlib_1  |     at Object.createTypings (/patternplate/node_modules/react-to-typescript-definitions/dist/src/typings.js:22:91)
patternlib_1  |     at generateFromAst (/patternplate/node_modules/react-to-typescript-definitions/dist/src/index.js:63:22)
patternlib_1  |     at generateFromSource (/patternplate/node_modules/react-to-typescript-definitions/dist/src/index.js:55:12)
patternlib_1  |     at Object.generateFromFile (/patternplate/node_modules/react-to-typescript-definitions/dist/src/index.js:25:12)
patternlib_1  |     at writeTypings (/patternplate/bin/create-typings.js:9:14)
patternlib_1  |     at Promise.all.paths.map.pathName (/patternplate/bin/create-typings.js:13:51)
patternlib_1  |     at Array.map (native)
patternlib_1  | 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant