From 9beea31e3faddd080aeee5ff8d02c2229984e0d7 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Thu, 5 Mar 2026 13:07:02 +0100 Subject: [PATCH] Fix types --- docs/.vitepress/lib/SvgPreview/types.ts | 7 +-- docs/.vitepress/lib/categories.ts | 18 ++++--- docs/package.json | 7 ++- docs/scripts/writeIconDetails.mjs | 4 +- pnpm-lock.yaml | 66 ++++++++++++++++++++++++- 5 files changed, 84 insertions(+), 18 deletions(-) diff --git a/docs/.vitepress/lib/SvgPreview/types.ts b/docs/.vitepress/lib/SvgPreview/types.ts index ecfe201db..5b146b95d 100644 --- a/docs/.vitepress/lib/SvgPreview/types.ts +++ b/docs/.vitepress/lib/SvgPreview/types.ts @@ -17,8 +17,5 @@ export type Path = { export type PathProps< RequiredProps extends keyof SVGProps, NeverProps extends keyof SVGProps, -> = Required, RequiredProps>> & - Omit< - React.SVGProps, - RequiredProps & NeverProps - >; +> = Required, RequiredProps>> & + Omit, RequiredProps | NeverProps>; diff --git a/docs/.vitepress/lib/categories.ts b/docs/.vitepress/lib/categories.ts index dfc0268b6..e94562047 100644 --- a/docs/.vitepress/lib/categories.ts +++ b/docs/.vitepress/lib/categories.ts @@ -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[] { 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, + ), + }), + ); } diff --git a/docs/package.json b/docs/package.json index e50b7b8a9..ff98550cd 100644 --- a/docs/package.json +++ b/docs/package.json @@ -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", diff --git a/docs/scripts/writeIconDetails.mjs b/docs/scripts/writeIconDetails.mjs index 7d8b66fbc..f8213799d 100644 --- a/docs/scripts/writeIconDetails.mjs +++ b/docs/scripts/writeIconDetails.mjs @@ -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 as IconMetaData const iconDetails = { name: '${iconName}', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82ee95172..502a45764 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -209,9 +209,15 @@ importers: svg-path-commander: specifier: ^2.1.11 version: 2.1.11 + typescript: + specifier: ^5.9.3 + version: 5.9.3 vitepress: specifier: ^1.6.4 version: 1.6.4(@algolia/client-search@5.44.0)(@types/node@24.10.1)(@types/react@18.3.27)(axios@1.13.2)(fuse.js@7.1.0)(less@4.2.0)(postcss@8.5.6)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.77.8)(search-insights@2.8.2)(stylus@0.56.0)(terser@5.44.1)(typescript@5.9.3) + vue-tsc: + specifier: ^3.2.5 + version: 3.2.5(typescript@5.9.3) packages/astro: devDependencies: @@ -5691,12 +5697,21 @@ packages: '@volar/language-core@2.4.23': resolution: {integrity: sha512-hEEd5ET/oSmBC6pi1j6NaNYRWoAiDhINbT8rmwtINugR39loROSlufGdYMF9TaKGfz+ViGs1Idi3mAhnuPcoGQ==} + '@volar/language-core@2.4.28': + resolution: {integrity: sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==} + '@volar/source-map@2.4.23': resolution: {integrity: sha512-Z1Uc8IB57Lm6k7q6KIDu/p+JWtf3xsXJqAX/5r18hYOTpJyBn0KXUR8oTJ4WFYOcDzWC9n3IflGgHowx6U6z9Q==} + '@volar/source-map@2.4.28': + resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==} + '@volar/typescript@2.4.23': resolution: {integrity: sha512-lAB5zJghWxVPqfcStmAP1ZqQacMpe90UrP5RJ3arDyrhy4aCUQqmxPPLB2PWDKugvylmO41ljK7vZ+t6INMTag==} + '@volar/typescript@2.4.28': + resolution: {integrity: sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==} + '@vue/compiler-core@3.5.24': resolution: {integrity: sha512-eDl5H57AOpNakGNAkFDH+y7kTqrQpJkZFXhWZQGyx/5Wh7B1uQYvcWkvZi11BDhscPgj8N7XV3oRwiPnx1Vrig==} @@ -5721,6 +5736,9 @@ packages: '@vue/devtools-shared@7.7.9': resolution: {integrity: sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==} + '@vue/language-core@3.2.5': + resolution: {integrity: sha512-d3OIxN/+KRedeM5wQ6H6NIpwS3P5gC9nmyaHgBk+rO6dIsjY+tOh4UlPpiZbAh3YtLdCGEX4M16RmsBqPmJV+g==} + '@vue/reactivity@3.5.24': resolution: {integrity: sha512-BM8kBhtlkkbnyl4q+HiF5R5BL0ycDPfihowulm02q3WYp2vxgPcJuZO866qa/0u3idbMntKEtVNuAUp5bw4teg==} @@ -6016,6 +6034,9 @@ packages: resolution: {integrity: sha512-f8IpsbdQjzTjr/4mJ/jv5UplrtyMnnciGax6/B0OnLCs2/GJTK13O4Y7Ff1AvJVAaztanH+m5nzPoUq6EAy+aA==} engines: {node: '>= 14.0.0'} + alien-signals@3.1.2: + resolution: {integrity: sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw==} + anser@1.4.10: resolution: {integrity: sha512-hCv9AqTQ8ycjpSd3upOJd7vFwW1JaoYQ7tpham03GJ1ca8/65rqn0RpaWpItOAd6ylW9wAw6luXYPJIyPFVOww==} @@ -8486,11 +8507,11 @@ packages: glob@7.2.0: resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} @@ -10125,6 +10146,9 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + muggle-string@0.4.1: + resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==} + multicast-dns-service-types@1.1.0: resolution: {integrity: sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ==} @@ -13315,6 +13339,12 @@ packages: peerDependencies: vue: 2.7.14 + vue-tsc@3.2.5: + resolution: {integrity: sha512-/htfTCMluQ+P2FISGAooul8kO4JMheOTCbCy4M6dYnYYjqLe3BExZudAua6MSIKSFYQtFOYAll7XobYwcpokGA==} + hasBin: true + peerDependencies: + typescript: '>=5.0.0' + vue@2.7.14: resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==} deprecated: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details. @@ -19223,14 +19253,26 @@ snapshots: dependencies: '@volar/source-map': 2.4.23 + '@volar/language-core@2.4.28': + dependencies: + '@volar/source-map': 2.4.28 + '@volar/source-map@2.4.23': {} + '@volar/source-map@2.4.28': {} + '@volar/typescript@2.4.23': dependencies: '@volar/language-core': 2.4.23 path-browserify: 1.0.1 vscode-uri: 3.1.0 + '@volar/typescript@2.4.28': + dependencies: + '@volar/language-core': 2.4.28 + path-browserify: 1.0.1 + vscode-uri: 3.1.0 + '@vue/compiler-core@3.5.24': dependencies: '@babel/parser': 7.29.0 @@ -19285,6 +19327,16 @@ snapshots: dependencies: rfdc: 1.4.1 + '@vue/language-core@3.2.5': + dependencies: + '@volar/language-core': 2.4.28 + '@vue/compiler-dom': 3.5.24 + '@vue/shared': 3.5.24 + alien-signals: 3.1.2 + muggle-string: 0.4.1 + path-browserify: 1.0.1 + picomatch: 4.0.3 + '@vue/reactivity@3.5.24': dependencies: '@vue/shared': 3.5.24 @@ -19610,6 +19662,8 @@ snapshots: '@algolia/requester-fetch': 5.44.0 '@algolia/requester-node-http': 5.44.0 + alien-signals@3.1.2: {} + anser@1.4.10: {} anser@2.3.3: {} @@ -24754,6 +24808,8 @@ snapshots: ms@2.1.3: {} + muggle-string@0.4.1: {} + multicast-dns-service-types@1.1.0: {} multicast-dns@6.2.3: @@ -28658,6 +28714,12 @@ snapshots: he: 1.2.0 vue: 2.7.14 + vue-tsc@3.2.5(typescript@5.9.3): + dependencies: + '@volar/typescript': 2.4.28 + '@vue/language-core': 3.2.5 + typescript: 5.9.3 + vue@2.7.14: dependencies: '@vue/compiler-sfc': 2.7.14