fix(monty-js): publish the component facade declaration in dist
Fixes #982
scripts/build-component.mjs builds two declarations for the WASI component: Jco's raw one, and a small facade that re-exports the WIT types with export * from './interfaces/pydantic-monty-worker.js'. Only the facade is imported by the library — host.ts pulls DispatchResult and Request from it, transport.ts pulls ConfigureRequest — and only the facade was written into the TypeScript source tree. dist/ got Jco's version, which declares just ImportObject, Root and instantiate.
The shipped dist/worker/host.d.ts and dist/worker/transport.d.ts therefore import names that ./component/monty.component.js does not export. Against @pydantic/monty@1.1.0, import { Monty } from '@pydantic/monty/wasm' with skipLibCheck: false:
node_modules/@pydantic/monty/dist/worker/host.d.ts(1,15): error TS2305: Module '"./component/monty.component.js"' has no exported member 'DispatchResult'.
node_modules/@pydantic/monty/dist/worker/host.d.ts(1,58): error TS2305: Module '"./component/monty.component.js"' has no exported member 'Request'.
node_modules/@pydantic/monty/dist/worker/transport.d.ts(3,15): error TS2305: Module '"./component/monty.component.js"' has no exported member 'ConfigureRequest'.
The fix
build-component.mjswrites the facade intodist/as well, replacing Jco'smonty.component.d.ts(nothing imports it). Both copies are byte-identical, and the file list Jco returns is otherwise unchanged.make check-wasm-typesgainsnpm run check:dist-types: askipLibCheck: falsepass over the builtdist/worker/index.d.ts, in a newtsconfig.dist.json. The package's owntsconfig.jsonbuilds fromts, so it can never catch this. I confirmed the new check reports the three TS2305 errors against the published 1.1.0distand is clean against adistbuilt with this change.
npm run lint (oxlint + tsc -p __test__/tsconfig.json) and prettier --check are clean.
Summary by cubic
Fixes #982: consumers of @pydantic/monty/wasm no longer hit TS2305 errors on DispatchResult, Request, and ConfigureRequest when compiling with skipLibCheck: false.
Previously the published dist/worker/component/monty.component.d.ts was Jco's generated declaration, not the facade that re-exports the WIT types, so host.d.ts and transport.d.ts shipped dangling imports.
- Copies the facade into
distin place of Jco's declaration, which nothing imports. - Adds
npm run check:dist-types, a strict consumer-side pass over the built declarations, run bymake check-wasm-types.