fix(core): resolve TS2308 duplicate exports so @proof/core compiles under TS5#57
fix(core): resolve TS2308 duplicate exports so @proof/core compiles under TS5#57devYRPauli wants to merge 1 commit into
Conversation
The @proof/core barrel re-exports both formats/marks and formats/provenance-sidecar with `export *`. Both modules export `createComment`, `getUnresolvedComments`, and `CommentReply`, so under TypeScript 5 the barrel fails to compile: src/index.ts: error TS2308: Module './formats/marks.js' has already exported a member named 'createComment'. Consider explicitly re-exporting to resolve the ambiguity. (same for getUnresolvedComments and CommentReply). This makes @proof/core unimportable from any consumer compiled under modern TS. Replace the `export *` from provenance-sidecar with explicit named re-exports of its 21 non-colliding symbols, letting marks.js own the three shared names (the marks-based API supersedes the legacy comment helpers). No other public export changes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a914e83320
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // createComment, getUnresolvedComments, and CommentReply are intentionally omitted | ||
| // here because marks.js owns those names in the new marks-based API. |
There was a problem hiding this comment.
Keep sidecar comment creation paired with addComment
For consumers that still use the legacy sidecar helpers from @proof/core, this omission makes createComment resolve to the marks API while addComment/ProvenanceData still come from provenance-sidecar. In the common flow addComment(provenance, createComment(selector, text, author)), TypeScript now rejects the Mark returned by the marks helper, and JavaScript callers would append a mark-shaped object to provenance.comments instead of a sidecar Comment, corrupting the legacy sidecar data. Consider preserving the sidecar helper under a non-colliding export or otherwise keeping the sidecar helper set internally consistent.
Useful? React with 👍 / 👎.
|
Thanks - that's a fair callout. The two
and with this barrel the bare Context for the choice: before this PR the barrel did The downside is exactly what you flagged: a legacy sidecar caller writing
Happy to push whichever you prefer - just let me know which name should own |
Problem
The
@proof/corebarrel (packages/doc-core/src/index.ts) re-exports bothsrc/formats/marks.tsandsrc/formats/provenance-sidecar.tswithexport *.Both modules export the same three names —
createComment,getUnresolvedComments, andCommentReply— so under TypeScript 5 the barrelfails to compile:
(same error for
getUnresolvedCommentsandCommentReply). The result is that@proof/corecan't be imported from any consumer compiled under modern,strict TypeScript.
Fix
Replace the
export *fromprovenance-sidecarwith explicit namedre-exports of its 21 non-colliding symbols (10 types + 11 values), letting
marks.tsown the three shared names. The marks-based API supersedes thelegacy comment helpers, so
marks.tsis the natural owner.No other public export changes — every previously-exported name remains
exported except the three duplicates, which are still available via
marks.Verification
tsc --noEmiton a consumer of@proof/coreemits the three TS2308errors above.
remain importable from
@proof/core.Question for maintainers
I let
markswin the three colliding names. If you'd preferprovenance-sidecarto own them instead, I'm happy to flip the direction —just let me know.