mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-12 13:38:32 +00:00
Fix types
This commit is contained in:
@@ -17,8 +17,5 @@ export type Path = {
|
||||
export type PathProps<
|
||||
RequiredProps extends keyof SVGProps<SVGPathElement | SVGRectElement | SVGCircleElement>,
|
||||
NeverProps extends keyof SVGProps<SVGPathElement | SVGRectElement | SVGCircleElement>,
|
||||
> = Required<Pick<React.SVGProps<SVGElement & SVGRectElement & SVGCircleElement>, RequiredProps>> &
|
||||
Omit<
|
||||
React.SVGProps<SVGPathElement & SVGRectElement & SVGCircleElement>,
|
||||
RequiredProps & NeverProps
|
||||
>;
|
||||
> = Required<Pick<SVGProps<SVGPathElement | SVGRectElement | SVGCircleElement>, RequiredProps>> &
|
||||
Omit<SVGProps<SVGPathElement | SVGRectElement | SVGCircleElement>, RequiredProps | NeverProps>;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Category, IconEntity } from '../theme/types';
|
||||
|
||||
const directory = path.join(process.cwd(), '../categories');
|
||||
|
||||
export function getAllCategoryFiles(): Category[] {
|
||||
export function getAllCategoryFiles(): Omit<Category, 'iconCount'>[] {
|
||||
const fileNames = fs.readdirSync(directory).filter((file) => path.extname(file) === '.json');
|
||||
|
||||
return fileNames.map((fileName) => {
|
||||
@@ -24,11 +24,13 @@ export function mapCategoryIconCount(
|
||||
categories: Category[],
|
||||
icons: { categories: IconEntity['categories'] }[],
|
||||
) {
|
||||
return categories.map((category) => ({
|
||||
...category,
|
||||
iconCount: icons.reduce(
|
||||
(acc, curr) => (curr.categories.includes(category.name) ? ++acc : acc),
|
||||
0,
|
||||
),
|
||||
}));
|
||||
return categories.map(
|
||||
(category): Category => ({
|
||||
...category,
|
||||
iconCount: icons.reduce(
|
||||
(acc, curr) => (curr.categories.includes(category.name) ? ++acc : acc),
|
||||
0,
|
||||
),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+5
-2
@@ -21,7 +21,8 @@
|
||||
"prebuild:api": "pnpm nitropack prepare",
|
||||
"build:api": "pnpm nitropack build",
|
||||
"build": "pnpm run /^prebuild:.*/ && pnpm run build:api && pnpm run build:docs && pnpm postbuild:vercelJson",
|
||||
"preview": "node .output/server/index.mjs"
|
||||
"preview": "node .output/server/index.mjs",
|
||||
"typecheck": "vue-tsc --noEmit"
|
||||
},
|
||||
"author": "Eric Fennis",
|
||||
"license": "ISC",
|
||||
@@ -35,7 +36,9 @@
|
||||
"nitropack": "^2.12.4",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"svg-path-commander": "^2.1.11",
|
||||
"vitepress": "^1.6.4"
|
||||
"typescript": "^5.9.3",
|
||||
"vitepress": "^1.6.4",
|
||||
"vue-tsc": "^3.2.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@analogjs/vite-plugin-nitro": "^2.3.0",
|
||||
|
||||
@@ -18,6 +18,7 @@ if (!fs.existsSync(iconDetailsDirectory)) {
|
||||
|
||||
const indexFile = path.resolve(iconDetailsDirectory, `index.ts`);
|
||||
|
||||
// TODO: User correct aliases type from next branch
|
||||
const writeIconFiles = icons.map(async (iconFileName) => {
|
||||
const iconName = path.basename(iconFileName, '.json');
|
||||
const location = path.resolve(iconDetailsDirectory, `${iconName}.ts`);
|
||||
@@ -26,8 +27,9 @@ const writeIconFiles = icons.map(async (iconFileName) => {
|
||||
import iconNode from '../iconNodes/${iconName}.node.json'
|
||||
import metaData from '../../../../icons/${iconName}.json'
|
||||
import releaseData from '../releaseMetadata/${iconName}.json'
|
||||
import { type IconMetaData } from '~/.vitepress/theme/types'
|
||||
|
||||
const { tags, categories, contributors, aliases, deprecated, deprecationReason, toBeRemovedInVersion } = metaData
|
||||
const { tags, categories, contributors, aliases, deprecated, deprecationReason, toBeRemovedInVersion } = metaData as Record<string, any> as IconMetaData
|
||||
|
||||
const iconDetails = {
|
||||
name: '${iconName}',
|
||||
|
||||
Reference in New Issue
Block a user