Skip to content
New issue

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

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

Already on GitHub? # to your account

bugfix: add HTMLAttributes Prop Type #649

Open
happy-devs opened this issue Nov 24, 2022 · 2 comments
Open

bugfix: add HTMLAttributes Prop Type #649

happy-devs opened this issue Nov 24, 2022 · 2 comments

Comments

@happy-devs
Copy link

Some components like Panel are showing errors when attributes like children are supplied. I'd suggest providing the HTMLAttributes<HTMLDivElement> type alongside the basic StandardProps; I'm happy to look through which ones need updating as a contributor.

export type PanelProps = StandardProps & {
/** Heading of the panel */
title: string
};

ERROR:
Type '{ children: (string | Element)[]; classModifiers: string; title: string; }' is not assignable to type 'IntrinsicAttributes & StandardProps & { title: string; }'.

@daniel-ac-martin
Copy link
Owner

@happy-devs: Sorry I missed this. I think this appears in newer versions of React. (What version are you on?)

Obviously, we will need to update the code to explicitly declare when children are valid. I'm not yet certain of the best approach for doing that across the board.

In the case of the Panel component, I agree we should allow all of the <div> attributes and so use HTMLAttributes<HTMLDivElement>.

Feel free to raise a PR, or I'll add it to my to-do list.

Thanks for raising this.

@daniel-ac-martin
Copy link
Owner

Related: #592

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants