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

fix(types): loosen icon prop type to any #2095

Merged
merged 2 commits into from
Feb 3, 2025
Merged

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Feb 3, 2025

carbon-design-system/carbon-icons-svelte#207

carbon-icons-svelte@13 and carbon-pictograms-svelte@13 now only offer TypeScript support Svelte 4/5.

However, the new Component type is incompatible with icon prop types in the carbon-components-svelte library. If using Svelte 5, a type error is shown for the icon prop, since typeof SvelteComponent is not compatible with the new Component type from Svelte 5.

Unfortunately, Component is not available in Svelte 3 or 4. For this library to be compatible with Svelte 3, 4, and 5, this PR loosens the icon prop type to any.

Note that the previous type typeof import("svelte").SvelteComponent<any> effectively typed it as "any" anyway.

@metonym metonym force-pushed the fix-icon-type-svelte-5 branch from e07c74d to c667d98 Compare February 3, 2025 03:45
@metonym metonym changed the title fix(types): extend icon prop type to support Component fix(types): loosen icon prop type to any Feb 3, 2025
@metonym metonym merged commit 6bf72d4 into master Feb 3, 2025
3 checks passed
@metonym metonym deleted the fix-icon-type-svelte-5 branch February 3, 2025 03:49
@metonym
Copy link
Collaborator Author

metonym commented Feb 3, 2025

Released in v0.87.4

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.

1 participant