Export IconType from @shopify/polaris-types

Hey Shopify team,

Would you be able to export IconType in the @shopify/polaris-types package?

Right now when we create a component that uses s-icon in its body and accepts an icon string as a prop, we can’t type it. Here’s an example:

Current approach

export const HeadingWithIcon = ({
  icon,
  title,
}: {
  icon: string;
  title: string;
}) => {
  return (
    <s-grid gridTemplateColumns="auto 1fr" gap="small-300" alignItems="center">
      <s-icon
        // @ts-expect-error - Polaris does not export the IconType type
        type={icon}
      />
      <s-heading>{title}</s-heading>
    </s-grid>
  );
};

Desired approach

import { IconType } from '@shopify/polaris-types';

export const HeadingWithIcon = ({
  icon,
  title,
}: {
  icon: IconType;
  title: string;
}) => {
  return (
    <s-grid gridTemplateColumns="auto 1fr" gap="small-300" alignItems="center">
      <s-icon type={icon} />
      <s-heading>{title}</s-heading>
    </s-grid>
  );
};

Thank you for your consideration!

Hi @Edi_Bouazza

Thanks for this feature request - it’s been highlighted to the Polaris product team.