Skip to content

Doesn’t remove propTypes in certain situations #196

@jaydenseric

Description

@jaydenseric

For all of the following examples, propTypes are incorrectly not removed:

import PropTypes from 'prop-types';

export default function Foo({ children }) {
  return children();
}

Foo.propTypes = {
  children: PropTypes.func.isRequired,
};

Babel REPL

import PropTypes from 'prop-types';

export default function Foo({ children }) {
  return children;
}

Foo.propTypes = {
  children: PropTypes.node,
};
import PropTypes from 'prop-types';

export default function Foo({ children }) {
  return <>{children}</>;
}

Foo.propTypes = {
  children: PropTypes.node,
};

While this works:

import PropTypes from 'prop-types';

export default function Foo({ children }) {
  return <div>{children}</div>;
}

Foo.propTypes = {
  children: PropTypes.node,
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions