fix(types): ship types for converter/docx-zipper/file-zipper subpaths (SD-2953)#3165
Merged
caio-pizzol merged 2 commits intomainfrom May 5, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… (SD-2953)
The three subpaths were exported at runtime via package.json `exports`
but had no `types` field. Strict TypeScript consumers importing any of
them got TS7016 ("could not find a declaration file"). The consumer-
typecheck matrix didn't catch this because no fixture imported these
subpaths.
The .d.ts targets already existed in dist (vite-plugin-dts emits them
from the super-editor source tree). The fix is to point at them:
- ./converter -> dist/super-editor/src/editors/v1/core/super-converter/SuperConverter.d.ts
- ./docx-zipper -> dist/super-editor/src/editors/v1/core/DocxZipper.d.ts
- ./file-zipper -> dist/super-editor/src/editors/v1/core/super-converter/zipper.d.ts
Update both the conditional `exports.<subpath>.types` field and the
parallel `typesVersions["*"]` mapping for legacy resolution modes.
Add three matrix fixtures (imports-converter.ts, imports-docx-zipper.ts,
imports-file-zipper.ts) that import through each public subpath and
assert the type resolves to a real declaration (IsAny check). Each
runs under bundler + node16 with skipLibCheck:false and strict.
Add packages/superdoc/scripts/check-export-coverage.cjs that asserts
every package.json `exports` entry has a `types` field, is a CSS asset,
or is on RUNTIME_ONLY_ALLOWLIST with a reason. Wires into postbuild so
this gap class can't reappear. Negative test: removing a `types` field
makes the audit exit 1 with a remediation message.
Update docs/architecture/package-boundaries.md to remove the
"runtime-only / no type contract" classification for these three
subpaths and reference the new fixtures.
Verified: build:es clean, consumer matrix 53/0/0 (47 baseline + 6 new
SD-2953 scenarios), runtime smoke 3/3 against the packed tarball
(SuperConverter, DocxZipper default, createZip), export-coverage audit
exits 1 on synthetic drift and 0 when correct.
The PR's first commit updated the inventory table but missed the Decision 4 body, which still read "exported as runtime-only entries today". Treat as stale comment per CLAUDE.md. Update the prose to describe the post-SD-2953 state: the three subpaths now carry types, matrix fixtures lock the contract in, and the export-coverage audit prevents the gap class from reappearing.
e434a8b to
ae23702
Compare
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.59 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.101 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0-next.103 |
Contributor
|
🎉 This PR is included in superdoc-cli v0.8.0-next.76 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc v1.30.0-next.59 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.59 |
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.
Closes the runtime-only export gap surfaced by multi-model review of the SD-2828 stack.
./converter,./docx-zipper, and./file-zipperwere exported at runtime viapackage.jsonexportsbut had notypesfield. Any strict TypeScript consumer importing them hit TS7016. The consumer-typecheck matrix didn't catch it because no fixture imported these subpaths today.The
.d.tstargets already existed in dist (vite-plugin-dts emits them from the super-editor source tree). The fix is to point at them and lock the decision in.Changes:
typesfield to each of the three conditionalexportsentries inpackage.json, plus matchingtypesVersions["*"]entries for the legacy resolution pathimports-converter.ts,imports-docx-zipper.ts,imports-file-zipper.ts) - each runs under bundler + node16 withskipLibCheck:falseandstrict, assertsIsAny<T>is false for the imported value, and exercises the documented .d.ts contractpackages/superdoc/scripts/check-export-coverage.cjsaudit: everyexportsentry must carry resolvable types, be a CSS asset, or be allowlisted as runtime-only legacy with a documented reason. Wired into postbuild so the gap class can't reappeardocs/architecture/package-boundaries.mdto remove the "runtime-only / no type contract" classification for these three subpathsVerified:
pnpm --filter superdoc build:escleanSuperConverter,DocxZipperdefault export,createZipall import and have expected typestypesfield makes the audit exit 1 with the remediation message; restoring exits 0Closes SD-2953. Unblocks SD-2952 (post-SD-2828 roadmap).