René's URL Explorer Experiment


Title: Type error when add custom Iconify IconSet customCollections · Issue #360 · unplugin/unplugin-icons · GitHub

Open Graph Title: Type error when add custom Iconify IconSet customCollections · Issue #360 · unplugin/unplugin-icons

X Title: Type error when add custom Iconify IconSet customCollections · Issue #360 · unplugin/unplugin-icons

Description: Describe the bug I try to implement this example: But i got type error My code: import IconsResolver from 'unplugin-icons/resolver'; import type { Options } from 'unplugin-icons/types'; import { importDirectory, parseColors, runSVGO } fr...

Open Graph Description: Describe the bug I try to implement this example: But i got type error My code: import IconsResolver from 'unplugin-icons/resolver'; import type { Options } from 'unplugin-icons/types'; import { im...

X Description: Describe the bug I try to implement this example: But i got type error My code: import IconsResolver from 'unplugin-icons/resolver'; import type { Options } from 'unplugin-icons/types&#...

Opengraph URL: https://github.com/unplugin/unplugin-icons/issues/360

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type error when add custom Iconify IconSet customCollections","articleBody":"### Describe the bug\n\nI try to implement this [example:](https://github.com/iconify/tools/tree/main/%40iconify-demo/unplugin-svelte)\r\nBut i got type error\r\n![image](https://github.com/unplugin/unplugin-icons/assets/39920617/1058de00-b9ae-4452-a5ac-cb69f76929be)\r\n\r\nMy code: \r\n```\r\nimport IconsResolver from 'unplugin-icons/resolver';\r\nimport type { Options } from 'unplugin-icons/types';\r\nimport { importDirectory, parseColors, runSVGO } from '@iconify/tools';\r\nimport { compareColors, stringToColor } from '@iconify/utils/lib/colors';\r\n\r\nconst assetsRootDir = 'src/assets/icons';\r\n\r\nexport const iconsResolver = IconsResolver(\r\n    {\r\n        prefix: 'i',\r\n        customCollections: ['ppd'],\r\n    },\r\n);\r\n\r\nexport const iconsConfig: Options = {\r\n    compiler: 'vue2',\r\n    customCollections: {\r\n        ppd: async () => {\r\n            // Load icons\r\n            const iconSet = await importDirectory(\r\n                `${assetsRootDir}/ppd`,\r\n                {\r\n                    prefix: 'ppd',\r\n                },\r\n            );\r\n\r\n            // Clean up each icon\r\n            await iconSet.forEach((name) => {\r\n                const svg = iconSet.toSVG(name);\r\n                if (!svg)\r\n                    return;\r\n\r\n                // Change color to `currentColor`\r\n                const blackColor = stringToColor('black')!;\r\n\r\n                parseColors(svg, {\r\n                    defaultColor: 'currentColor',\r\n                    callback: (attr, colorStr, color) => {\r\n                        // console.log('Color:', colorStr, color);\r\n\r\n                        // Change black to 'currentColor'\r\n                        if (color && compareColors(color, blackColor))\r\n                            return 'currentColor';\r\n\r\n                        switch (color?.type) {\r\n                            case 'none':\r\n                            case 'current':\r\n                                return color;\r\n                        }\r\n\r\n                        throw new Error(\r\n                            `Unexpected color \"${colorStr}\" in attribute ${attr}`,\r\n                        );\r\n                    },\r\n                });\r\n\r\n                // Optimise, but do not change shapes because they are animated\r\n                runSVGO(svg, {\r\n                    keepShapes: true,\r\n                });\r\n\r\n                // Update icon in icon set\r\n                iconSet.fromSVG(name, svg);\r\n            });\r\n            console.log(iconSet.export());\r\n\r\n            // Export as IconifyJSON\r\n            return iconSet.export();\r\n        },\r\n    },\r\n};\r\n```\r\n\r\npackage.json:\r\n```\r\n{\r\n    \"name\": \"intro-storybook-vue-template\",\r\n    \"version\": \"0.2.0\",\r\n    \"private\": true,\r\n    \"description\": \"Starter template to get up and running quickly with Vue and Storybook\",\r\n    \"author\": \"Chromatic \u003chttps://chromatic.com/>\",\r\n    \"license\": \"MIT\",\r\n    \"repository\": {\r\n        \"type\": \"git\",\r\n        \"url\": \"https://github.com/chromaui/intro-storybook-vue-template\"\r\n    },\r\n    \"bugs\": {\r\n        \"url\": \"https://github.com/chromaui/intro-storybook-vue-template/issues\"\r\n    },\r\n    \"scripts\": {\r\n        \"dev\": \"vite\",\r\n        \"build\": \"vite build\",\r\n        \"preview\": \"vite preview\",\r\n        \"lint\": \"eslint . --fix\",\r\n        \"format\": \"prettier --write src/\",\r\n        \"storybook\": \"storybook dev -p 6006\",\r\n        \"build-storybook\": \"storybook build\",\r\n        \"init-msw\": \"msw init public/\"\r\n    },\r\n    \"dependencies\": {\r\n        \"@iconify/tools\": \"^4.0.4\",\r\n        \"unplugin-icons\": \"^0.19.0\",\r\n        \"vue\": \"^2.7.16\",\r\n        \"vue-template-es2015-compiler\": \"^1.9.1\"\r\n    },\r\n    \"devDependencies\": {\r\n        \"@antfu/eslint-config\": \"^2.16.2\",\r\n        \"@storybook/addon-essentials\": \"^7.6.6\",\r\n        \"@storybook/addon-interactions\": \"^7.6.6\",\r\n        \"@storybook/addon-links\": \"^7.6.6\",\r\n        \"@storybook/blocks\": \"^7.6.6\",\r\n        \"@storybook/test\": \"^7.6.6\",\r\n        \"@storybook/vue\": \"^7.6.6\",\r\n        \"@storybook/vue-vite\": \"^7.6.6\",\r\n        \"@types/node\": \"^20.12.12\",\r\n        \"@vitejs/plugin-vue2\": \"^2.3.1\",\r\n        \"eslint\": \"^8.50.0\",\r\n        \"msw\": \"^1.2.1\",\r\n        \"msw-storybook-addon\": \"^1.10.0\",\r\n        \"react\": \"^18.2.0\",\r\n        \"react-dom\": \"^18.2.0\",\r\n        \"sass\": \"1.32\",\r\n        \"storybook\": \"^7.6.6\",\r\n        \"ts-node\": \"^10.9.2\",\r\n        \"typescript\": \"^5.4.5\",\r\n        \"unplugin-vue-components\": \"^0.26.0\",\r\n        \"vite\": \"^4.1.4\",\r\n        \"vue-cli-plugin-vuetify\": \"~2.5.1\",\r\n        \"vue-component-type-helpers\": \"^2.0.16\",\r\n        \"vue-template-compiler\": \"^2.7.16\",\r\n        \"vuetify\": \"2.6.15\",\r\n        \"vuetify-loader\": \"1.7.3\"\r\n    },\r\n    \"resolutions\": {\r\n        \"jackspeak\": \"2.1.1\"\r\n    }\r\n}\r\n```\r\n\n\n### Reproduction\n\nImplement this [example:](https://github.com/iconify/tools/tree/main/%40iconify-demo/unplugin-svelte)\n\n### System Info\n\n```Shell\nSystem:\r\n    OS: Windows 11 10.0.22631\r\n    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz\r\n    Memory: 2.17 GB / 15.89 GB\r\n  Binaries:\r\n    Node: 16.20.2 - C:\\Program Files\\nodejs\\node.EXE\r\n    npm: 8.19.4 - C:\\Program Files\\nodejs\\npm.CMD\r\n  Browsers:\r\n    Edge: Chromium (123.0.2420.97)\r\n    Internet Explorer: 11.0.22621.3527\n```\n\n\n### Used Package Manager\n\nnpm\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://github.com/antfu/.github/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guide](https://github.com/antfu/contribute).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.\n- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.\n- [X] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.","author":{"url":"https://github.com/deicidem","@type":"Person","name":"deicidem"},"datePublished":"2024-05-14T13:15:58Z","url":"https://github.com/unplugin/unplugin-icons/issues/360"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f66d3182-93a3-eb8d-6dcc-44f8d44e8273
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE736:1BD385:24287A:32B99A:6B0058E3
html-safe-nonce55a926caf797be30fba2fe0461803cf6e66e34342054fe9d0a52634841713605
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzM2OjFCRDM4NToyNDI4N0E6MzJCOTlBOjZCMDA1OEUzIiwidmlzaXRvcl9pZCI6IjM2MDcxOTY4NTg3ODg2MzI4MDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7ece1685ebb967cc130325bf931b69b8f36b1e08f24c0410f1766ce2db9912c7
hovercard-subject-tagissue:2295434274
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unplugin/unplugin-icons/360/issue_layout
twitter:imagehttps://opengraph.githubassets.com/955cb2329c5466ff24115d692518f001554024b3fa5236eadd883862a7fc76bc/unplugin/unplugin-icons/issues/360
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/955cb2329c5466ff24115d692518f001554024b3fa5236eadd883862a7fc76bc/unplugin/unplugin-icons/issues/360
og:image:altDescribe the bug I try to implement this example: But i got type error My code: import IconsResolver from 'unplugin-icons/resolver'; import type { Options } from 'unplugin-icons/types'; import { im...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedeicidem
hostnamegithub.com
expected-hostnamegithub.com
None29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73
turbo-cache-controlno-preview
go-importgithub.com/unplugin/unplugin-icons git https://github.com/unplugin/unplugin-icons.git
octolytics-dimension-user_id143585159
octolytics-dimension-user_loginunplugin
octolytics-dimension-repository_id324073430
octolytics-dimension-repository_nwounplugin/unplugin-icons
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id324073430
octolytics-dimension-repository_network_root_nwounplugin/unplugin-icons
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseeacd927ba6112e3b01ba99c762bd699a4a4f5df7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/unplugin/unplugin-icons/issues/360#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funplugin%2Funplugin-icons%2Fissues%2F360
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funplugin%2Funplugin-icons%2Fissues%2F360
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=unplugin%2Funplugin-icons
Reloadhttps://github.com/unplugin/unplugin-icons/issues/360
Reloadhttps://github.com/unplugin/unplugin-icons/issues/360
Reloadhttps://github.com/unplugin/unplugin-icons/issues/360
unpluginhttps://github.com/unplugin
unplugin-iconshttps://github.com/unplugin/unplugin-icons
Codehttps://github.com/unplugin/unplugin-icons
Issues80 (80)https://github.com/unplugin/unplugin-icons/issues
Pull requests8 (8)https://github.com/unplugin/unplugin-icons/pulls
Discussionshttps://github.com/unplugin/unplugin-icons/discussions
Actionshttps://github.com/unplugin/unplugin-icons/actions
Security and qualityhttps://github.com/unplugin/unplugin-icons/security
Insightshttps://github.com/unplugin/unplugin-icons/insights
https://github.com/unplugin/unplugin-icons
New issuehttps://github.com/login?return_to=https://github.com/unplugin/unplugin-icons/issues/360
New issuehttps://github.com/login?return_to=https://github.com/unplugin/unplugin-icons/issues/360
Type error when add custom Iconify IconSet customCollectionshttps://github.com/unplugin/unplugin-icons/issues/360#top
https://github.com/deicidem
deicidemhttps://github.com/deicidem
on May 14, 2024https://github.com/unplugin/unplugin-icons/issues/360#issue-2295434274
example:https://github.com/iconify/tools/tree/main/%40iconify-demo/unplugin-svelte
https://private-user-images.githubusercontent.com/39920617/330442868-1058de00-b9ae-4452-a5ac-cb69f76929be.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTUxODUxNjgsIm5iZiI6MTc5NTE4NDg2OCwicGF0aCI6Ii8zOTkyMDYxNy8zMzA0NDI4NjgtMTA1OGRlMDAtYjlhZS00NDUyLWE1YWMtY2I2OWY3NjkyOWJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTIwVDE0Mjc0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZmMjFkYWJhYmE5NTc5MWYwMzdhZTJhODc3MzcyMTJkOTEzZTFiNjFiYWU5NDhlMGIwMDAwMGRkMmNmM2VlZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.bw2zLgDhNXCb8cXyV7U4YR3HS4C3eHJHF3v3Fsbx9rI
example:https://github.com/iconify/tools/tree/main/%40iconify-demo/unplugin-svelte
Code of Conducthttps://github.com/antfu/.github/blob/main/CODE_OF_CONDUCT.md
Contributing Guidehttps://github.com/antfu/contribute
minimal reproduciblehttps://stackoverflow.com/help/minimal-reproducible-example
Sign up for freehttps://github.com/signup?return_to=https://github.com/unplugin/unplugin-icons/issues/360
Sign in to commenthttps://github.com/login?return_to=https://github.com/unplugin/unplugin-icons/issues/360
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.