Skip to content

fix(types): ship types for converter/docx-zipper/file-zipper subpaths (SD-2953)#3165

Merged
caio-pizzol merged 2 commits intomainfrom
caio-pizzol/SD-2953-runtime-only-types
May 5, 2026
Merged

fix(types): ship types for converter/docx-zipper/file-zipper subpaths (SD-2953)#3165
caio-pizzol merged 2 commits intomainfrom
caio-pizzol/SD-2953-runtime-only-types

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Closes the runtime-only export gap surfaced by multi-model review of the SD-2828 stack.

./converter, ./docx-zipper, and ./file-zipper were exported at runtime via package.json exports but had no types field. 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.ts targets 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:

  • Add types field to each of the three conditional exports entries in package.json, plus matching typesVersions["*"] entries for the legacy resolution path
  • Three new matrix fixtures (imports-converter.ts, imports-docx-zipper.ts, imports-file-zipper.ts) - each runs under bundler + node16 with skipLibCheck:false and strict, asserts IsAny<T> is false for the imported value, and exercises the documented .d.ts contract
  • New packages/superdoc/scripts/check-export-coverage.cjs audit: every exports entry 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 reappear
  • Update docs/architecture/package-boundaries.md to remove the "runtime-only / no type contract" classification for these three subpaths

Verified:

  • pnpm --filter superdoc build:es clean
  • Consumer matrix: 53 passed, 0 failed, 0 warnings (47 baseline + 6 new SD-2953 scenarios)
  • Runtime smoke 3/3 against the packed tarball: SuperConverter, DocxZipper default export, createZip all import and have expected types
  • Export-coverage audit negative test: removing a types field makes the audit exit 1 with the remediation message; restoring exits 0

Closes SD-2953. Unblocks SD-2952 (post-SD-2828 roadmap).

@caio-pizzol caio-pizzol requested a review from a team as a code owner May 5, 2026 16:04
@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol caio-pizzol self-assigned this May 5, 2026
… (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.
@caio-pizzol caio-pizzol force-pushed the caio-pizzol/SD-2953-runtime-only-types branch from e434a8b to ae23702 Compare May 5, 2026 17:35
@caio-pizzol caio-pizzol merged commit ad0e5a9 into main May 5, 2026
67 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-2953-runtime-only-types branch May 5, 2026 20:11
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.59

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.101

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.103

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in superdoc-cli v0.8.0-next.76

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in superdoc v1.30.0-next.59

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in superdoc-sdk v1.8.0-next.59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants