fix(typecheck): enable @ts-check on packages/superdoc/src/index.js#3478
Merged
Conversation
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.
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First debt drain on the JSDoc ratchet snapshot.
packages/superdoc/src/index.jswas the only file underpackages/superdoc/on the 103-entry public-reachable debt list; this PR moves it from "tracked debt" to "fully gated by// @ts-check". Snapshot count: 103 β 102.Tight diff: 2 files, +5/-3 lines.
Two type errors surfaced and got fixed
./core/theme/create-theme.tsimport had an explicit.tsextension - TS rejects this withoutallowImportingTsExtensions. Changed to.js. The rest of the file already uses.js(the canonical convention), andpackages/superdoc/src/public/index.ts:55-56imports the same module via.js.'@superdoc/common/data/blank.docx?url'Vite asset import has no static type. Suppressed with// @ts-expect-error- same patternsrc/public/index.tsalready uses.Why per-file
@ts-expect-errorinstead of a global*?urlambient shimI tried the cleaner ambient approach first (
packages/superdoc/src/shims-url.d.tsdeclaring*?url). It let the import resolve cleanly, but vite-plugin-dts then preserved the@superdoc/common/data/blank.docx?urlimport statement in the emittedpublic/index.d.ts, which trippedaudit-declarations.cjs's "private workspace specifier" rule. Per-file suppression keeps the import "unknown" from TS's perspective, which keeps it from leaking into the .d.ts. The longer-term fix (rewriting?urlspecifiers inensure-types.cjsso the ambient shim is safe) is a separate piece of work.Verified
pnpm check:typesβ PASS (tsc -bclean across all referenced projects)pnpm check:public:superdocβ PASS, 9 stages, 156s. Thejsdoc-ratchetstage now reportsOK 6 CHECKED_FILES clean; ratchet snapshot in syncwithindex.jsproperly accounted for via// @ts-checkrather than the debt snapshot.audit-declarations.cjs(postbuild) β clean. No@superdoc/*specifier leak.What this is NOT
.js; just type-checked.stores/superdoc-store.js,core/surface-manager.js,core/create-app.js) are not on the public-reachable surface, so adding// @ts-checkthere wouldn't drain the snapshot. Pick those up only if the goal becomes "harden internals", not "drain known debt".Snapshot diff
packages/superdoc/scripts/jsdoc-debt-snapshot.json: one line removed (packages/superdoc/src/index.js). 102 entries remain - all underpackages/super-editor/src/editors/v1/**.