Skip to content

Re-home paratext-bible-send-receive.d.ts seam, remove dead duplicate (PT-4213)#2570

Merged
lyonsil merged 1 commit into
mainfrom
pt-4213-send-receive-dts-cleanup
Jul 18, 2026
Merged

Re-home paratext-bible-send-receive.d.ts seam, remove dead duplicate (PT-4213)#2570
lyonsil merged 1 commit into
mainfrom
pt-4213-send-receive-dts-cleanup

Conversation

@rolfheij-sil

@rolfheij-sil rolfheij-sil commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What was wrong

Core carried two copies of the paratext-bible-send-receive type declarations:

  • extensions/src/platform-scripture-editor/src/types/paratext-bible-send-receive.d.ts
  • extensions/src/platform-get-resources/src/types/paratext-bible-send-receive.d.ts

Because loose .d.ts files under an extension's src/types are only picked up by that extension's own include: ["src"] (typeRoots only auto-include package folders via their types entry), each copy was visible only to its own extension's program. Every other consumer (core src/, platform-scripture) got its send-receive typings from a third place — the paratextBibleSendReceive.* command declarations that had accumulated inside platform-get-resources.d.ts — i.e. the seam worked by inclusion luck, not by design.

The consequences:

  • Both copies drifted stale in different ways — junk ProjectFileType members ('' | 'edited' | 'new' | 'unregistered' | 'stuff'), outdated ResultStatus/ResultInfo/ResultsData shapes, an old VerseRef-based signature in one copy, missing newer commands/events.

  • Cross-repo duplicate-identifier/merge noise: extension repos developed against core (including the Send/Receive extension itself) list core's extensions/src in their typeRoots, so platform-get-resources.d.ts merges into their programs. Its paratextBibleSendReceive.syncProjects declaration conflicts with the Send/Receive extension's own authoritative one, producing a live TS2717 in that extension's program today:

    platform-get-resources.d.ts(112,5): error TS2717: Property ''paratextBibleSendReceive.syncProjects'' must be of type
    '(projectIds: string[]) => Promise<ResultsData>', but here has type '(projectIds?: string[] | undefined) => Promise<void>'.
    

What changed

  • One seam file: src/@types/paratext-bible-send-receive/index.d.ts, re-synced from the Send/Receive extension's current contract and trimmed to the subset this repo actually consumes (commands getSharedProjects, sendReceiveProjects, openSyncStatus, commitChanges, commitDaily, syncProjects, syncOpenProjects, cancelSync; events onSyncStateChanged, onSyncProgress; the payload types they reference; the two settings). src/@types is a typeRoots entry for core and every bundled extension (same mechanism as src/@types/react-19-compat), so the seam is ambient in all of this repo's programs — while external extension repos' programs (which include core's extensions/src but not core's src/@types) no longer see core's copy at all, eliminating the duplicate/conflicting-declaration class of problem at the root.
  • Deleted both stale copies.
  • platform-get-resources.d.ts now declares only platformGetResources.* (with a comment explaining why send-receive declarations must not live there).
  • NetworkEvents now types paratextBibleSendReceive.onSyncStateChanged / onSyncProgress (the established pattern, cf. platform-scripture.d.ts).
  • Toolbar: dropped the (sendCommand as any) cast for paratextBibleSendReceive.openSyncStatus — the command is now properly declared.

Why not the platform-get-resources.d.ts types entry (the platform-scripture.d.ts pattern)? That pattern is right for types an extension in this repo owns. Here the owner is a closed-source extension whose own program includes core's extension types entries, so any core copy of the module placed there collides with the authoritative declarations (duplicate identifiers for the module's types, TS2717 for any drifted command). The seam file's header documents this.

Note: syncProjects deliberately keeps this repo's C# stub shape (String[]? param, no return value — core's startup sync passes undefined to mean "sync all"), rather than the extension's own (projectIds: string[]) => Promise<ResultsData>; the declaration's doc comment explains the difference.

How verified

  • tsc --listFilesOnly for the root, platform-scripture-editor, platform-get-resources, and platform-scripture programs: each now contains exactly one file declaring the paratext-bible-send-receive module and its commands (the new seam file).
  • npm run typecheck:core and npm run typecheck --workspaces --if-present: all clean.
  • npm run build:types: papi.d.ts unchanged (no regen needed).
  • eslint + prettier on all changed files: clean.
  • vitest run src/renderer/components/platform-bible-toolbar.test.tsx: 21/21 pass (covers the de-cast openSyncStatus call).

Based on post-#2555 main (b88969f), so no rebase pending. Part of PT-4213 (item 5).

🤖 Generated with Claude Code

Self-review — 2026-07-17 (review-paratext methodology)

APPROVE — no blocking defect; the type-seam re-home is correct, minimal, and root-causes the TS2717 duplicate-type class. Four analysis passes (api / style / compliance / ux) per .claude/agents/review-analyzer.md, run by a review-lead agent; author interview substituted with the PR body + PRD design records; every finding adversarially verified against code and tests.

# severity finding disposition
1 important #2560 (unmerged sibling on the same base) adds runScheduledSessionSync to the exact seam file this PR renames/rewrites pending — merge-time reconciliation: the declaration folds into the new src/@types seam on whichever PR rebases second; trial-rebased and confirmed a loud content conflict (not a silent drop), with a typecheck backstop if ever mis-resolved
2 important the Paratext 10 Studio overlay carries a now-redundant counterpart of this change against a file this PR deletes (this PR's new seam already has those fields) pending — the overlay updates accordingly when this PR merges (tracked internally)
3 minor sendReceiveProjects signature narrowed to a required projectIds param accepted (syncs to extension's authoritative contract)
4 minor PR claim "src/@types is a typeRoots entry for every bundled extension" is inaccurate (platform-enhanced-resources excluded) accepted (harmless, doesn't consume the seam)
5 minor syncProjects deliberately diverges from the extension's authoritative contract accepted (documented + justified in a doc comment)

Gates: typecheck:core PASS, typecheck --workspaces --if-present PASS (incl. 3 consumer extensions), build:typespapi.d.ts no diff, vitest platform-bible-toolbar.test.tsx 21/21 PASS.


This change is Reviewable

…dead duplicates

Core carried two drifting copies of the Send/Receive extension's type
declarations (under platform-scripture-editor and platform-get-resources),
each visible only to its own extension's TS program, while part of the
contract leaked to every other consumer through platform-get-resources.d.ts.
Both copies had gone stale (junk ProjectFileType members, outdated command
signatures), and the send-receive command declarations in
platform-get-resources.d.ts conflict with the Send/Receive extension's own
authoritative declarations in that extension's program (TS2717 on
syncProjects today), because extension repos' typeRoots auto-include core
extensions' advertised types files.

Re-home the seam as a single copy in src/@types/paratext-bible-send-receive/
(ambient in core and in every bundled extension program via typeRoots, but
not included by external extension repos' programs), re-synced from the
extension's current contract and trimmed to the subset this repo consumes.
Delete both stale copies, remove the send-receive declarations from
platform-get-resources.d.ts, declare the two send-receive network events in
NetworkEvents, and drop the no-longer-needed `as any` cast on the toolbar's
openSyncStatus call.

PT-4213

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lyonsil
lyonsil force-pushed the pt-4213-send-receive-dts-cleanup branch from 47fba45 to b0be72a Compare July 18, 2026 01:05

@lyonsil lyonsil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@lyonsil partially reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved.

@lyonsil
lyonsil merged commit 57ca331 into main Jul 18, 2026
7 checks passed
@lyonsil
lyonsil deleted the pt-4213-send-receive-dts-cleanup branch July 18, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants