Skip to content

feat: add Solid 2 types - #442

Open
everton-dgn wants to merge 1 commit into
unplugin:mainfrom
everton-dgn:feat/solid2-types
Open

everton-dgn wants to merge 1 commit into
unplugin:mainfrom
everton-dgn:feat/solid2-types

Conversation

@everton-dgn

Copy link
Copy Markdown

Description

In Solid 2 the JSX namespace and the ComponentProps that resolves intrinsic elements live in @solidjs/web. solid-js 2.0.0-rc.13 doesn't export JSX anymore, and its ComponentProps<'svg'> is never (solid/src/client/component.ts#L59, web/src/index.ts#L37 and #L93-L97).

types/solid.d.ts imports both from solid-js, so every icon ends up typed as (props: never) => JSX.Element. With solid-js and @solidjs/web 2.0.0-rc.13 and "types": ["unplugin-icons/types/solid"], even <Icon /> from ~icons/mdi/home fails with TS2322: Type '{}' is not assignable to type 'never'. With skipLibCheck: false, types/solid.d.ts itself also errors: TS2305 on the JSX import and TS2344 on ComponentProps<'svg'>.

This adds types/solid2.d.ts, a copy of solid.d.ts that imports from @solidjs/web, the ./types/solid2 export and one line in the Solid section of the README. types/solid stays as it is for Solid 1.

Linked Issues

None.

Additional context

I packed this branch and installed the tarball in a project on solid-js and @solidjs/web 2.0.0-rc.13, then ran tsc on two small files: one renders ~icons/mdi/home and virtual:icons/mdi/home, the other assigns an icon to Component<ComponentProps<'svg'>> and passes it to dynamic(). Across TypeScript 5.9.3 and 7.0.2, moduleResolution bundler and node16, and skipLibCheck true and false, types/solid fails in every combination and types/solid2 passes in every one, with an unknown prop on <Icon /> still an error. Solid 1.9.15 with types/solid still passes.

pnpm lint, pnpm typecheck, pnpm test --run, pnpm build and publint pass.

Solid 2 is still in RC. If you'd rather wait for 2.0.0 and switch types/solid over then, like #381 did for Svelte 5, I can change it.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Copy Markdown
Author

Hi! When you have a moment, could a maintainer authorize the Publish Any Commit workflow and take a look at this proposal? I'd appreciate your guidance on adding a separate Solid 2 type entry during the RC period. No rush, and thanks!

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/unplugin-icons@442

commit: dca568d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant