Skip to content

Commit

Permalink
fix(types): loosen icon prop type to any (#2095)
Browse files Browse the repository at this point in the history
Fixes carbon-design-system/carbon-icons-svelte#207

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

The new `Component` type is incompatible with the `icon` prop in  
`carbon-components-svelte`, causing a type error with Svelte 5, as  
`typeof SvelteComponent` doesn't match the new `Component` type.

Since `Component` isn't available in Svelte 3/4, this PR changes  
the `icon` prop type to `any` for compatibility across Svelte 3, 4, and 5.
  • Loading branch information
metonym authored Feb 3, 2025
1 parent ece9e03 commit 6bf72d4
Show file tree
Hide file tree
Showing 44 changed files with 271 additions and 249 deletions.
272 changes: 136 additions & 136 deletions COMPONENT_INDEX.md

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\nAlternatively, use the named slot \"icon\" (e.g., `<Icon slot=\"icon\" size=\"{20}\" />`)",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -2570,7 +2570,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\nIcon is rendered to the left of the label text",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5771,7 +5771,7 @@
"name": "iconMenu",
"kind": "let",
"description": "Specify the icon to render for the closed state.\nDefaults to `<Menu size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand All @@ -5782,7 +5782,7 @@
"name": "iconClose",
"kind": "let",
"description": "Specify the icon to render for the opened state.\nDefaults to `<Close size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5849,7 +5849,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render when the action panel is closed.\nDefaults to `<Switcher size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand All @@ -5860,7 +5860,7 @@
"name": "closeIcon",
"kind": "let",
"description": "Specify the icon to render when the action panel is open.\nDefaults to `<Close size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5996,7 +5996,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -6059,7 +6059,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -7007,7 +7007,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\n`inline` must be `false`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -7987,7 +7987,7 @@
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -8228,7 +8228,7 @@
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -9000,7 +9000,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -9712,7 +9712,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render.\nDefaults to `<OverflowMenuVertical />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -12032,7 +12032,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render.\nDefaults to `<Search />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -12974,7 +12974,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -13054,7 +13054,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -15061,7 +15061,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -17297,7 +17297,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render for the tooltip button.\nDefault to `<Information />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -17646,7 +17646,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "any",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -17956,9 +17956,9 @@
"ts": "type TreeNodeId = string | number;\n"
},
{
"type": "{ id: TreeNodeId; text: any; icon?: typeof import(\"svelte\").SvelteComponent<any>; disabled?: boolean; nodes?: TreeNode[]; }",
"type": "{ id: TreeNodeId; text: any; icon?: any; disabled?: boolean; nodes?: TreeNode[]; }",
"name": "TreeNode",
"ts": "interface TreeNode {\n id: TreeNodeId;\n text: any;\n icon?: typeof import(\"svelte\").SvelteComponent<any>;\n disabled?: boolean;\n nodes?: TreeNode[];\n}\n"
"ts": "interface TreeNode {\n id: TreeNodeId;\n text: any;\n icon?: any;\n disabled?: boolean;\n nodes?: TreeNode[];\n}\n"
}
],
"generics": null,
Expand Down
Loading

0 comments on commit 6bf72d4

Please sign in to comment.