Fix types

This commit is contained in:
Eric Fennis
2026-03-05 13:07:02 +01:00
parent ee8b855533
commit 9beea31e3f
5 changed files with 84 additions and 18 deletions
+2 -5
View File
@@ -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>;
+10 -8
View File
@@ -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,
),
}),
);
}