[lit@3.1.0] the inferred type of 'render' cannot be named without a reference
- Dominant language
- TypeScript
- Stars
- 21.8k
- Forks
- 1.1k
- Avg merge
- 18h 25m
- Merged PRs (30d)
- 2
Description
### Which package(s) are affected?
Lit Core (lit / lit-html / lit-element / reactive-element)
### Description
While migrating to the latest version of lit (3.1.0), I stumbled upon the following ts error in [one](https://github.com/justeattakeaway/pie/blob/main/packages/components/pie-modal/src/index.ts) of our components.
The issue only happens if you're importing `html` from `lit/static-html.js` and using lit@3.1.0
I think this might be related to the [lit-html@3.1.0](https://github.com/lit/lit/commit/949a54677748a1f83ec4d166bd40e244de3afda7) version bump as one of our dependencies `@open-wc/testing@3.2.2` was still pointing to an older version, resulting in the error.
upgrading `@open-wc/testing` to `latest | 4.0.0` seems to fix the issue for us but wanted to document the issue and bring it to the team's attention just in case other areas are affected ⭐
feel free to close the issue if all is good and no action is needed 🤝
### Reproduction
install `@open-wc/testing@3.2.2` in a typescript project with `lit@3.1.0` and have this simple lit element
```
import { LitElement } from 'lit';
import { html } from 'lit/static-html.js';
class Greeting extends LitElement{
render () {
return html`
}
}
```
### Workaround
make sure `lit-html` is pointing to the latest version either by updating the package that relies on it such as `@open-wc/testing` or adding a resolution entry to pakcage.json
### Is this a regression?
Yes. This used to work, but now it doesn't.
### Affected versions
3.1.0
### Browser/OS/Node environment
typescript@5.1.3
Contributor guide
Research direction
Start by reproducing the TypeScript error from packages/components/pie-modal/src/index.ts with lit@3.1.0 and @open-wc/testing@3.2.2. Check the dependency versions and package.json resolution workaround described in the issue, then determine whether Lit needs a change; done means confirming a Lit fix or documenting that upgrading the dependency resolves it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100