From 98cbb1518859c489800b152043b6db08d80b5cbd Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Sun, 24 May 2026 12:17:32 -0300 Subject: [PATCH] fix(typecheck): enable @ts-check on packages/superdoc/src/index.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drains one entry from jsdoc-debt-snapshot.json (103 → 102) - the only SuperDoc-package file on the public-reachable JSDoc surface that wasn't yet gated. Two type errors surfaced and got fixed: 1. `./core/theme/create-theme.ts` import had an explicit .ts extension, which TS rejects without `allowImportingTsExtensions`. Changed to .js to match the rest of the file's convention (and packages/superdoc/src/public/index.ts:55-56 imports the same module via .js). 2. The `'@superdoc/common/data/blank.docx?url'` Vite asset import has no type. Suppressed with `// @ts-expect-error` - same pattern src/public/index.ts already uses. A global `*?url` ambient declaration would resolve the import cleanly but lets the @superdoc/common specifier leak into the emitted .d.ts, which trips audit-declarations.cjs's private-workspace-specifier rule. The per-file suppression keeps the leak from happening. Verified: pnpm check:types PASS; pnpm check:public:superdoc PASS, 9 stages, 156s. jsdoc-ratchet stage now reports `6 CHECKED_FILES clean; ratchet snapshot in sync` with index.js properly accounted for via // @ts-check rather than the debt snapshot. --- packages/superdoc/scripts/jsdoc-debt-snapshot.json | 3 +-- packages/superdoc/src/index.js | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/superdoc/scripts/jsdoc-debt-snapshot.json b/packages/superdoc/scripts/jsdoc-debt-snapshot.json index f8adff0215..8f0ff8e6ea 100644 --- a/packages/superdoc/scripts/jsdoc-debt-snapshot.json +++ b/packages/superdoc/scripts/jsdoc-debt-snapshot.json @@ -102,7 +102,6 @@ "packages/super-editor/src/editors/v1/extensions/track-changes/trackChangesHelpers/replaceAroundStep.js", "packages/super-editor/src/editors/v1/extensions/track-changes/trackChangesHelpers/replaceStep.js", "packages/super-editor/src/editors/v1/extensions/track-changes/trackChangesHelpers/trackedTransaction.js", - "packages/super-editor/src/editors/v1/extensions/underline/underline.js", - "packages/superdoc/src/index.js" + "packages/super-editor/src/editors/v1/extensions/underline/underline.js" ] } diff --git a/packages/superdoc/src/index.js b/packages/superdoc/src/index.js index daaed5f22a..9057308edc 100644 --- a/packages/superdoc/src/index.js +++ b/packages/superdoc/src/index.js @@ -1,3 +1,4 @@ +// @ts-check import { SuperConverter, Editor, @@ -34,6 +35,8 @@ import { SlashMenu, } from '@superdoc/super-editor'; import { DOCX, PDF, HTML, getFileObject, compareVersions } from '@superdoc/common'; +// @ts-expect-error Vite resolves DOCX asset URL imports; plain tsc does not. +// Keep local suppression until URL asset imports can be typed without d.ts leaks. import BlankDOCX from '@superdoc/common/data/blank.docx?url'; import { getSchemaIntrospection } from './helpers/schema-introspection.js'; @@ -234,7 +237,7 @@ import { getSchemaIntrospection } from './helpers/schema-introspection.js'; // Public exports export { SuperDoc } from './core/SuperDoc.js'; -export { createTheme, buildTheme } from './core/theme/create-theme.ts'; +export { createTheme, buildTheme } from './core/theme/create-theme.js'; export { BlankDOCX, getFileObject,