diff --git a/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx b/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx index 5173170c6..ed4ae4c5f 100644 --- a/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx +++ b/packages/wonder-blocks-icon/src/components/phosphor-icon.tsx @@ -35,7 +35,7 @@ type Props = Pick & { * The icon to display. This is a reference to the icon asset * (imported as a static SVG file). */ - icon: PhosphorIconAsset; + icon: PhosphorIconAsset | string; }; /** diff --git a/types/assets.d.ts b/types/assets.d.ts index 20b03b089..d0fa8b4d5 100644 --- a/types/assets.d.ts +++ b/types/assets.d.ts @@ -5,4 +5,25 @@ */ declare module "*.jpg"; declare module "*.png"; + +// Support specific SVG paths from @phosphor-icons/core. +declare type PhosphorRegular = string & {weight: "PhosphorRegular"}; +declare module "@phosphor-icons/core/regular/*.svg" { + const icon: PhosphorRegular; + export default icon; +} + +declare type PhosphorBold = string & {weight: "PhosphorBold"}; +declare module "@phosphor-icons/core/bold/*-bold.svg" { + const icon: PhosphorBold; + export default icon; +} + +declare type PhosphorFill = string & {weight: "PhosphorFill"}; +declare module "@phosphor-icons/core/fill/*-fill.svg" { + const icon: PhosphorFill; + export default icon; +} + +// Fall back to generic SVG support. declare module "*.svg";