Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property selected should include PropTypes.number to allow integer values #1625

Open
ADTC opened this issue Mar 23, 2023 · 1 comment · May be fixed by #1627
Open

Property selected should include PropTypes.number to allow integer values #1625

ADTC opened this issue Mar 23, 2023 · 1 comment · May be fixed by #1627

Comments

@ADTC
Copy link

ADTC commented Mar 23, 2023

const SelectedPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])

Please allow PropTypes.number here. Sometimes the value is numeric - quite common when display label is a string, but internal value is an int.

Although the application works, this throws error in the console.

Warning: Failed prop type: Invalid prop `selected` supplied to `SelectMenu`, expected one of type [string].
SelectMenu@webpack-internal:///./node_modules/evergreen-ui/esm/select-menu/src/SelectMenu.js:39:15
▽ React 6
        printWarning
        error
        checkPropTypes
        validatePropTypes
        jsxWithValidation
        jsxWithValidationDynamic

Right now I'm overriding the propTypes to fix the error:

SelectMenu.propTypes = {
  ...SelectMenu.propTypes,
  selected: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.arrayOf(PropTypes.string),
    PropTypes.number,
  ]),
};
@AbhiJain2196
Copy link

Added type number to proptypes #1627

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants