solidjs / solid

A declarative, efficient, and flexible JavaScript library for building user interfaces.
https://solidjs.com
MIT License
31.79k stars 901 forks source link

error TS2307: Cannot find module 'lit-dom-expressions' or its corresponding type declarations. #1457

Closed trusktr closed 1 year ago

trusktr commented 1 year ago

Describe the bug

When importing html from solid-js/html while using TypeScript, this error can happen:

node_modules/solid-js/html/types/index.d.ts:1:32 - error TS2307: Cannot find module 'lit-dom-expressions' or its corresponding type declarations.

1 declare const _default: import("lit-dom-expressions").HTMLTag;
                                 ~~~~~~~~~~~~~~~~~~~~~

Your Example Website or App

n/a

Steps to Reproduce the Bug or Issue

No simple reproduction yet. I'm refactoring lume right now to use idiomatic solid-js, and classy-solid, and in the process I've removed lit-dom-expressions from @lume/element (because the idea is anyone using html should import it from solid-js/html.

However, removing this explicit dependency on lit-dom-expressions causes the type error.

Hoping I can provide a simple reproduction later.

Expected behavior

solid-js should include dependencies that it depends on. It is missing lit-dom-expressions from dependencies.

Note, I'm still on 1.4, because 1.5 is breaking for lume and I still need to make further refactors to catch up. So, I haven't tested with latest yet, but I see package.json is missing lit-dom-expressions in dependencies.

Screenshots or Videos

n/a

Platform

n/a

Possible Solution

It might be reasonable to add a build step that copies lit-dom-expression types into the repo, and have html get the types from there, instead of from lit-dom-expressions, like with other parts of solid-js that copy files from other packages to avoid having extra "dependencies".

trusktr commented 1 year ago

Ah, I see this is supposed to be handled here already:

https://github.com/solidjs/solid/blob/bcfcb5c4ff3ccc50d25f939f46c38a786e57a313/packages/solid/package.json#L262

Closing. Will try to get myself updated.