Skip to content

fix(types): type remaining trackChangesHelpers via JSDoc (SD-2980 PR C)#3443

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-2980-track-changes-remaining-jsdoc
May 22, 2026
Merged

fix(types): type remaining trackChangesHelpers via JSDoc (SD-2980 PR C)#3443
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-2980-track-changes-remaining-jsdoc

Conversation

@caio-pizzol

Copy link
Copy Markdown
Contributor

Closes out SD-2980's helper typing. The remaining 4 public helpers under trackChangesHelpers (via superdoc/super-editor) now carry concrete JSDoc and emit real return shapes:

  • getLiveInlineMarksInRangePmMark[]
  • findTrackedMarkBetweenTrackedMarkRange | null
  • trackedTransactionTransaction
  • getTrackChangesTrackedMarkRange[]

Reuses PR B's trackChangesHelpers/types.js; adds one typedef TrackedMarkRange = { from, to, mark } shared by findTrackedMarkBetween's non-null return and getTrackChanges's element shape.

trackedTransaction.js also had a hand-written trackedTransaction.d.ts shim from #3105 that forced the public emit back to (...args: any[]) => any. Deleting it lets the source JSDoc own the emitted type, which matches the SD-2922 shadow-file policy. The JSDoc on trackedTransaction.js also moved from the single-blob @param {{ ... }} params form (doesn't bind to the destructured arrow signature in dts emit) to per-property style.

  • Drains 14 of 14 PR C audit findings; tier-3-helpers is now 0 (broad audit 171 → 157)
  • Supported-root strict gate remains 0; remaining broad-audit findings are outside SD-2980 scope
  • Consumer fixture extended with PR C coverage (return types, element members, literal-union narrowing, @ts-expect-error on bad args)

Verified: type-check clean; pnpm test:editor → 13120 pass; deep-type-audit --pack → 157 findings (was 171); --strict-supported-root → PASS (0 entries); typecheck-matrix → 79/79.

Closes out SD-2980's helper typing. The remaining 4 public helpers
exported via `trackChangesHelpers` (under `superdoc/super-editor`) now
carry concrete JSDoc and emit real return shapes instead of
`any` / `any[]`:

- `getLiveInlineMarksInRange({ doc, from, to })` → `PmMark[]`
- `findTrackedMarkBetween({ tr, from, to, markName, attrs?, offset? })`
  → `TrackedMarkRange | null`
- `trackedTransaction({ tr, state, user, replacements? })` → `Transaction`
- `getTrackChanges(state, id?)` → `TrackedMarkRange[]`

Reuses the existing `trackChangesHelpers/types.js` from PR B; adds one
new typedef:

- `TrackedMarkRange = { from: number; to: number; mark: PmMark }`
  shared by `findTrackedMarkBetween`'s non-null return and
  `getTrackChanges`'s array element.

`trackedTransaction.js` notes: the previous JSDoc used the single-blob
`@param {{ ... }} params` form, which does NOT bind to the destructured
arrow signature in vite-plugin-dts emit. Switched to per-property style
(matches PR B's working `findMarkInRangeBySnapshot` pattern). Also
deleted `trackedTransaction.d.ts` — a hand-written shim added in #3105
that pinned the emit to `(...args: any[]): any` and silently shadowed
the real JSDoc. The shim is NOT in the `check-dts-shadows` allowlist
(only `packages/collaboration-yjs/` is), so deletion aligns with the
SD-2922 policy.

Drains the final 14 of 14 PR C audit findings; `tier-3-helpers` reaches
0 for the first time (total broad audit 171 → 157). The remaining
broad findings live outside SD-2980 scope (`tier-5-other`,
`tier-4-public-contract` for SD-3235). Supported-root strict gate
remains 0.

Consumer fixture `track-changes-helpers-typed.ts` extended with PR C
coverage: each new helper's return type, element members
(`mark.type.name`, `from`, `to`), `Transaction` PM surface
(`.docChanged`, `.steps`), literal-union `replacements`, nullable
state, and `@ts-expect-error` on bad-shape args.

Scope intentionally narrow: no other trackChangesHelpers files touched
(internal step builders untouched), no helper de-dupe, no refactors.

Verified: type-check clean; pnpm test:editor → 13120 pass;
deep-type-audit --pack → 157 findings (was 171); --strict-supported-root
→ PASS (0 entries); typecheck-matrix → 79/79.
@caio-pizzol
caio-pizzol requested a review from a team as a code owner May 22, 2026 13:06
@linear-code

linear-code Bot commented May 22, 2026

Copy link
Copy Markdown

SD-2980

@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 merged commit b99f9a3 into main May 22, 2026
71 checks passed
@caio-pizzol
caio-pizzol deleted the caio-pizzol/SD-2980-track-changes-remaining-jsdoc branch May 22, 2026 13:40
@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc-cli v0.12.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc-sdk v1.11.0

@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in @superdoc-dev/mcp v0.7.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in superdoc v1.35.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in @superdoc-dev/react v1.6.0

The release is available on GitHub release

@superdoc-bot

superdoc-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in vscode-ext v2.7.0

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