mirror of
https://github.com/TriliumNext/Trilium.git
synced 2026-10-12 02:09:59 +00:00
`trilium-env.d.ts` types the `api` global as
`import("@triliumnext/commons/src/lib/script_api").BackendApi`, but
script-deployer did not depend on `@triliumnext/commons`. Under pnpm 12.6's
hoisted linker the package was not resolvable from script-deployer, and
because the import sits in a `.d.ts` under `skipLibCheck`, TypeScript
silently typed `api` as `any`, so no deployer script was really
type-checked.
pnpm 12.7 links every workspace package into the root `node_modules`,
which made commons resolvable and surfaced the one mismatch:
`BackendApi.xml2js` is `unknown`, so `api.xml2js.parseString(...)` in
auto-import-xopp.ts fails with TS18046. That broke `pnpm typecheck` (and
the docs build that runs it) on the Renovate pnpm 12.7.0 PR (#11777).
Declare the dependency so the types no longer depend on hoisting, and
cast `api.xml2js` to `typeof import("xml2js")` in the script. The cast
stays at the call site because `script_api.ts` must remain import-free:
it is bundled into the in-editor language service, where `xml2js` types
cannot resolve.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XhgnHVsNGe3CCzuNYwBARk