Repository navigation
feat: add Solid 2 types - #442
Open
everton-dgn wants to merge 1 commit into
Open
everton-dgn wants to merge 1 commit into
everton-dgn wants to merge 1 commit into
Conversation
|
|
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! |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In Solid 2 the
JSXnamespace and theComponentPropsthat resolves intrinsic elements live in@solidjs/web.solid-js2.0.0-rc.13 doesn't exportJSXanymore, and itsComponentProps<'svg'>isnever(solid/src/client/component.ts#L59, web/src/index.ts#L37 and #L93-L97).types/solid.d.tsimports both fromsolid-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/homefails withTS2322: Type '{}' is not assignable to type 'never'. WithskipLibCheck: false,types/solid.d.tsitself also errors: TS2305 on theJSXimport and TS2344 onComponentProps<'svg'>.This adds
types/solid2.d.ts, a copy ofsolid.d.tsthat imports from@solidjs/web, the./types/solid2export and one line in the Solid section of the README.types/solidstays 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
tscon two small files: one renders~icons/mdi/homeandvirtual:icons/mdi/home, the other assigns an icon toComponent<ComponentProps<'svg'>>and passes it todynamic(). Across TypeScript 5.9.3 and 7.0.2,moduleResolutionbundlerandnode16, andskipLibChecktrue and false,types/solidfails in every combination andtypes/solid2passes in every one, with an unknown prop on<Icon />still an error. Solid 1.9.15 withtypes/solidstill passes.pnpm lint,pnpm typecheck,pnpm test --run,pnpm buildandpublintpass.Solid 2 is still in RC. If you'd rather wait for 2.0.0 and switch
types/solidover then, like #381 did for Svelte 5, I can change it.