Skip to content

Commit

Permalink
Revert simplifying types and add 'string' as valid option
Browse files Browse the repository at this point in the history
  • Loading branch information
jandrade committed Nov 16, 2023
1 parent 54c17ed commit ad069a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Props = Pick<AriaProps, "aria-hidden" | "aria-label"> & {
* The icon to display. This is a reference to the icon asset
* (imported as a static SVG file).
*/
icon: PhosphorIconAsset;
icon: PhosphorIconAsset | string;
};

/**
Expand Down
21 changes: 21 additions & 0 deletions types/assets.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

0 comments on commit ad069a4

Please sign in to comment.