Which package(s) are affected?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
Upgrading to typescript@5.8.2, on a project that uses node16 module/moduleResolution, results in the following error:
> tsc
node_modules/lit-html/development/lit-html.d.ts:7:34 - error TS2307: Cannot find module 'trusted-types/lib' or its corresponding type declarations.
7 import type { TrustedHTML } from 'trusted-types/lib';
~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/lit-html/development/lit-html.d.ts:7
Reproduction
mkdir lit-type-issue
cd lit-type-issue
npm init -y
npm i typescript lit
npx tsc --init --skipLibCheck false --module node16 --moduleResolution node16
echo "import * as lit from 'lit'; console.log(lit);" > index.ts
npx tsc --noEmit
Workaround
- turn on skipLibCheck to avoid type-checking .d.ts files
- avoid using the newest typescript version
- avoid node16 moduleResolution
Is this a regression?
Yes. This used to work, but now it doesn't.
Affected versions
failing with typescript 5.8.2, passes with 5.7.3
Browser/OS/Node environment
Browser: irrelevant
OS: Fedora 41
Node: 22.14.0
npm: 10.9.2