Skip to content

Proptypes not working correctly for PropTypes.node #1

@ngreenwood6

Description

@ngreenwood6

We started a new project for React 19 and decided to use your library. However, the PropTypes.node is giving us issues. It is giving this error Warning: Failed prop type: Invalid prop 'children' supplied to 'Component', expected a ReactNode.. This is happening because i didn't pass any children to it, but it is not marked as required so it should not be doing this. I have posted a sample below that should allow you to reproduce it if you use that component and don't pass any children:

import PropTypes from 'prop-types';

const Component = ({ children, text }) => {
  return (
    <div>{children}</div>
  );
}

Component.propTypes = {
  children: PropTypes.node,
  text: PropTypes.string
}

export default Component;

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