refactor(superdoc): type optional event callback registration#3085
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.34 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.76 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.78 |
|
🎉 This PR is included in superdoc v1.30.0-next.35 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.8.0-next.52 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.38 |
|
🎉 This PR is included in superdoc-cli v0.9.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.32.0 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/mcp v0.4.0 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.3.0 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.4.0 |
|
🎉 This PR is included in superdoc-sdk v1.9.0 |
SD-2867 Cluster C only: type-only fix for the EventEmitter registration sites in
SuperDoc.jswhereConfig.on*callbacks are typed as optional but the publicConfigmakes them so.#initListeners(14 sites) and#addToolbar'stoolbar.on('exception', ...)(1 site).asEventListener<T>identity helper; runtime returns the exact same value EventEmitter would have received before, so there is no defaulting or guard behavior change. If a consumer ever passesundefinedexplicitly, EventEmitter sees the sameundefinedit would have without the wrapper.nullvs typedefundefined,Usertypedef vsDEFAULT_USERshape) or the heterogeneous Cluster D fixes (provider widening,SearchMatchshape,DocumentModeliteral, etc.). Those each have consumer-observable trade-offs and need a separate audit.Boundary check (matters for SD-2828 / SD-2867 separation):
The
asEventListenerhelper is declared at module scope insideSuperDoc.js, not on the class.grep -E "asEventListener|EventListener" packages/superdoc/dist/superdoc/src/core/SuperDoc.d.tsreturns no matches — the helper does not appear in the emitted public declarations.Verified:
pnpm --filter superdoc check:jsdoc→ 3 gated files cleanpnpm --filter superdoc build:es→ no FAIL-level findingsnode tests/consumer-typecheck/typecheck-matrix.mjs→ 33 passed, 0 failed