1.6 KiB
1.6 KiB
description
| description |
|---|
| lit-analyzer runs from scripts/lit-check.ts, which maps "typescript" to the aliased typescript-6 devDependency; npm run lit-check in CI |
Applies to Lit repos that ran cunarist/deno-lit-analyzer under Deno.
lit-analyzer is built on TypeScript's JavaScript compiler API and is run against TypeScript 6 (the open question was whether it works with TS 7 / tsgo). The repo installs TS 6 under another name and redirects lit-analyzer to it, so the rest of the toolchain is unaffected (decided 2026-10-16):
// package.json
"scripts": { "lit-check": "node scripts/lit-check.ts" },
"devDependencies": { "typescript-6": "npm:typescript@^6", "lit-analyzer": "..." }
// scripts/lit-check.ts (shape)
import { registerHooks } from "node:module";
registerHooks({
resolve(specifier, context, next) {
// when lit-analyzer asks for "typescript", hand it TS 6
return next(specifier === "typescript" ? "typescript-6" : specifier, context);
},
});
// then run lit-analyzer
- Node runs the
.tsscript directly (type stripping), so no build step. - Import the package entry, or spawn the package's bin with
node:child_process, rather thanawait import("lit-analyzer/cli.js").project/no-asset-importsallows.jssubpaths, but the CLI file runs on import and bypasses the package's public entry. - CI runs
npm run lit-checkas its own step. - It is tooling under
scripts/: no tests; a narrowoverridesentry for it (e.g.no-console) is allowed if truly needed.
Don't replace this with a global TypeScript downgrade, a second
tsconfig, or a .js wrapper script.