Renovamen / oh-vue-icons

A Vue component for importing inline SVG icons from different popular icon packs easily.
https://oh-vue-icons.js.org
Other
245 stars 22 forks source link

chore(type): add customize icon type of index.d.ts, closed #18 #19

Closed Zhengqbbb closed 2 years ago

Zhengqbbb commented 2 years ago

Why:

My icons array is not well supported and type checked when I use typescript

const icons = [
  {
    name: "mail",
    width: 24,
    height: 24,
    d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V8l6.94 4.34c.65.41 1.47.41 2.12 0L20 8v9c0 .55-.45 1-1 1zm-7-7L4 6h16l-8 5z"
  }
];
addIcons(...icons);

Expect

import type { CustomizeIconType } from "oh-vue-icons";
const icons: CustomizeIconType[] = [
  {
    name: "mail",
    width: 24,
    height: 24,
    d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V8l6.94 4.34c.65.41 1.47.41 2.12 0L20 8v9c0 .55-.45 1-1 1zm-7-7L4 6h16l-8 5z"
  }
];
addIcons(...icons);
Renovamen commented 2 years ago

Done, thank you!