@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
10 lines (6 loc) • 480 B
TypeScript
import type * as icons from "@esri/calcite-ui-icons";
import type { KebabCase } from "type-fest";
export type IconName = KebabCaseIcons | CamelCaseIcons;
export type CamelCaseIcons = ExtractBaseIcon<keyof typeof icons>;
export type KebabCaseIcons = KebabCase<CamelCaseIcons>;
export type ExtractBaseIcon<T> = T extends `${infer Base}${"16" | "24" | "32"}F` ? `${Base}F` : T extends `${infer Base}F` ? `${Base}F` : T extends `${infer Base}${"16" | "24" | "32"}` ? Base : never;