fix(types): type remaining trackChangesHelpers via JSDoc (SD-2980 PR C)#3443
Merged
caio-pizzol merged 1 commit intoMay 22, 2026
Merged
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
🎉 This PR is included in superdoc-cli v0.12.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.11.0 |
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.7.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc v1.35.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.6.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in vscode-ext v2.7.0 |
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 out SD-2980's helper typing. The remaining 4 public helpers under
trackChangesHelpers(viasuperdoc/super-editor) now carry concrete JSDoc and emit real return shapes:getLiveInlineMarksInRange→PmMark[]findTrackedMarkBetween→TrackedMarkRange | nulltrackedTransaction→TransactiongetTrackChanges→TrackedMarkRange[]Reuses PR B's
trackChangesHelpers/types.js; adds one typedefTrackedMarkRange = { from, to, mark }shared byfindTrackedMarkBetween's non-null return andgetTrackChanges's element shape.trackedTransaction.jsalso had a hand-writtentrackedTransaction.d.tsshim 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 ontrackedTransaction.jsalso moved from the single-blob@param {{ ... }} paramsform (doesn't bind to the destructured arrow signature in dts emit) to per-property style.tier-3-helpersis now 0 (broad audit 171 → 157)@ts-expect-erroron 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.