dataesr / react-dsfr

Non-official React components of the official french Système de Design de l'État.
https://dataesr.github.io/react-dsfr/
MIT License
44 stars 22 forks source link

Checkbox misses checked property in TypeScript #298

Closed Falinor closed 1 year ago

Falinor commented 1 year ago

I am trying to implement a set of checkboxes in a table. This table features a select-all checkbox which, when clicked, should select all checkboxes. This behavior works as intended, although typescript is complaining about the checked property being missing in the type definition. It is also the case for onClick and some other properties.

Some websites recommend to use React.ComponentPropsWithRef for the following result:

interface CheckboxProps extends ComponentPropsWithRef<'input'> {
  // Some more properties
}

Before Screenshot 2022-11-17 at 15 53 35 After Screenshot 2022-11-17 at 15 52 21

I noted that no component uses this interface. Is it intended? In a DRY attempt to reduce code repetition and serve proper types to typescript users, is there any argument against this?

Please not that I can write the PR myself if needed.

Thanks

SophieTopart commented 1 year ago

Hello, I am using myself several of your components in a Typescript project, and I had to manually add missing types in the index.d.ts file in my node modules react-dsfr directory... Let me know if you need to know which ones were missing, or need help updating your repo.

SophieTopart commented 1 year ago

By the way, I also encounter problems with icons display in tables' headers (sort function) and alerts (close button), do you have a slack community or anything else where this could be discussed?

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 3.4.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: