Skip to content

feat: add html attributes to cards #435

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

Merged
merged 3 commits into from
Jul 10, 2025
Merged

Conversation

iNeoO
Copy link
Contributor

@iNeoO iNeoO commented Jul 10, 2025

#434

I believe all valid HTML attributes for a

should be allowed on the Card component.
I removed the type assertion. I'm not sure why it was there in the first place.

@ddecrulle
Copy link
Collaborator

Hello,

Thanks for the proposal.

The type assertion is intentional. It ensures we destructure all props explicitly, so nothing is unintentionally passed via rest. Without this, rest wouldn’t be inferred as never, and we could accidentally miss props without noticing.

We do spread rest onto the <div> to allow custom or non-standard HTML attributes, but that naturally leads to type issues that user needs to explicitly ignore.

To resolve this without compromising type safety, I’d suggest introducing a dedicated prop nativeDivElement. That’s consistent with the pattern we’ve followed elsewhere in the codebase, and it allows us to keep the Equals<keyof rest, never> check valid and meaningful.

@iNeoO
Copy link
Contributor Author

iNeoO commented Jul 10, 2025

Hmm, I'm not really convinced it's worth doing the assertion, but I made the change you asked for.

@ddecrulle ddecrulle merged commit 39888ef into codegouvfr:main Jul 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants