Skip to content

TypeScript

@lucide/angular 包导出的类型列表。这些可以在 TypeScript Angular 项目中使用 Lucide 图标时用于为你的组件指定类型

🌐 List of exported types from the @lucide/angular package. These can be used to type your components when using Lucide icons in a TypeScript Angular project

类型

🌐 Types

LucideIcon

表示一个自包含的 Lucide 图标组件类型,该类型具有静态 icon 属性。你可以在声明图标属性的模式中使用此类型。

🌐 Represents a self-containing Lucide icon component type that has a static icon property. You can use this type in schemas that declare an icon property.

ts
export interface LucideIcon extends Type<LucideIconProps> {
  icon: LucideIconData;
}

LucideIconData

一个 Lucide 图标对象,能够完整描述要显示的图标。

🌐 A Lucide icon object that fully describes an icon to be displayed.

ts
export type LucideIconData = {
  name: string;
  node: LucideIconNode[];
  aliases?: string[];
};

类型保护

🌐 Type guards

isLucideIconData

ts
export function isLucideIconData(icon: unknown): icon is LucideIconData {
  return true | false
}

isLucideIconComponent

ts
export function isLucideIconComponent(icon: unknown): icon is LucideIcon {
  return true | false
}