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

Incomplete type definition for CheckBoxGroup component (missing children type) #7012

Open
DavidMathevet opened this issue Nov 8, 2023 · 0 comments
Labels
typescript Typescript enhancements and bugs

Comments

@DavidMathevet
Copy link

DavidMathevet commented Nov 8, 2023

The CheckBoxGroup type definition in index.d.ts seems incomplete, it is missing a type definition for the optional children prop

The issue is probably similar to the ones reported for List (#6836 still open) and RadioButtonGroup (#6109 fixed and merged)

Expected Behavior

In a typescript project, when using the children prop, the type should be as defined in the Grommet component documentation:
image

Actual Behavior

The type for the children prop is not defined, therefore the compiler expects a REACT.ReactNode and throws an error:

TS2322: Type '(option: (string | CheckBoxType)[], { checked }: { checked: boolean; }) => JSX.Element' is not assignable to type 'ReactNode'.

Steps to Reproduce

  1. Create a typescript project
  2. Add a CheckBoxGroup and set the children props using a function
  3. npm start and get the error

Your Environment

Package.json extract:

  "dependencies": {
    "@brightcove/player-loader": "^1.8.0",
    "@reduxjs/toolkit": "^1.9.7",
    "@testing-library/jest-dom": "^6.1.4",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.5.1",
    "@types/react": "^18.2.34",
    "@types/react-dom": "^18.2.14",
    "@types/youtube": "^0.0.49",
    "grommet": "^2.34.0",
    "grommet-icons": "^4.11.0",
    "grommet-theme-hpe": "^5.1.1",
    "polished": "^4.2.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-hook-form": "^7.47.0",
    "react-redux": "^8.1.3",
    "react-router-dom": "^6.16.0",
    "react-scripts": "^5.0.1",
    "react-syntax-highlighter": "^15.5.0",
    "styled-components": "^5.3.11",
    "typescript": "^4.9.5",
    "web-vitals": "^3.5.0"
@jcfilben jcfilben added the typescript Typescript enhancements and bugs label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Typescript enhancements and bugs
Projects
None yet
Development

No branches or pull requests

2 participants