From 9d8b381434d7f39859a051a1f1d5fa4daa1f3b62 Mon Sep 17 00:00:00 2001 From: Nik Divjak Date: Mon, 25 May 2026 08:08:14 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20v0.1.1=20=E2=80=94=20consumers=20typeche?= =?UTF-8?q?ck=20clean=20without=20re-adding=20workarounds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because the engine ships TS source (no build), a consumer's tsc/svelte-check resolves into the engine's .ts and inherited two type-resolution needs: - the `declare module "*.xsd"` ambient for the e-SLOG XSD text-imports, and - node-forge types. Fix (no API/runtime change): - validate-eslog.ts carries a triple-slash `/// ` to types.d.ts so the *.xsd ambient enters any consumer's compilation that loads it. - @types/node-forge moved to dependencies so consumers get node-forge types transitively. Consumers on ^0.1.0 auto-inherit 0.1.1; no consumer bump needed. Benefits the demo lib + the medusa-plugin. 44 pass / 1 skip, tsc clean. Note: the bun `with { type: "text" }` XSD load vs Vite `?raw` (a separate *bundler* concern, not typecheck) is being verified by the demo's vite build — a bundler-neutral load is a candidate v0.1.2 if confirmed. Co-Authored-By: Claude Opus 4.7 (1M context) --- bun.lock | 2 +- package.json | 4 ++-- src/lib/eslog/validate-eslog.ts | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bun.lock b/bun.lock index 9baf6a6..8d9cd6b 100644 --- a/bun.lock +++ b/bun.lock @@ -6,6 +6,7 @@ "name": "@grunt-it/fiscalize", "dependencies": { "@e-invoice-eu/core": "^3.1.1", + "@types/node-forge": "^1.3.14", "ajv": "^8.18.0", "ajv-formats": "^3.0.1", "effect": "^3.18.4", @@ -16,7 +17,6 @@ }, "devDependencies": { "@types/bun": "latest", - "@types/node-forge": "^1.3.14", "typescript": "^5", }, }, diff --git a/package.json b/package.json index 9f3681c..2bf71d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@grunt-it/fiscalize", - "version": "0.1.0", + "version": "0.1.1", "description": "Private/internal grunt-it Slovenian fiscalization + e-invoicing toolkit (TS/Effect). P1: EN16931 → e-SLOG 2.0 / UBL e-invoice generation + validation, deriving from E-Invoice-EU. Framework-agnostic engine.", "type": "module", "license": "UNLICENSED", @@ -48,11 +48,11 @@ }, "devDependencies": { "@types/bun": "latest", - "@types/node-forge": "^1.3.14", "typescript": "^5" }, "dependencies": { "@e-invoice-eu/core": "^3.1.1", + "@types/node-forge": "^1.3.14", "ajv": "^8.18.0", "ajv-formats": "^3.0.1", "effect": "^3.18.4", diff --git a/src/lib/eslog/validate-eslog.ts b/src/lib/eslog/validate-eslog.ts index c188d41..9b339fc 100644 --- a/src/lib/eslog/validate-eslog.ts +++ b/src/lib/eslog/validate-eslog.ts @@ -1,3 +1,8 @@ +/// +// The reference above carries the `declare module "*.xsd"` ambient into any +// consumer's compilation that loads this file (the engine ships TS source, so a +// consumer's tsc resolves these .xsd text-imports). Keeps consumers from having +// to re-declare the ambient themselves. import { Effect } from "effect"; import { validateXML } from "xmllint-wasm"; import { EInvoiceGenerationError, EslogValidationError, type ValidationIssue } from "../foundation/errors";