Skip to content

Commit 9045a26

Browse files
authored
fix(superdoc): close public typedef gaps surfaced by SuperDoc.js probe (SD-2872) (#3046)
* fix(superdoc): close public typedef gaps surfaced by SuperDoc.js probe (SD-2872) Probing `// @ts-check` against `packages/superdoc/src/core/SuperDoc.js` (per the SD-2863 ratchet) surfaced 16 properties that the implementation reads but the public JSDoc typedefs do not declare. Each missing field is a customer-typeable property the runtime supports today but TypeScript reports as unknown for consumers. Adds: Config.useLayoutEngine Config.onFontsResolved Config.socket Modules.whiteboard SuperDocLayoutEngineOptions.virtualization (+ enabled, window, overscan) SuperDocLayoutEngineOptions.showBookmarks User.color Document.role Verified locally: enabling `// @ts-check` on SuperDoc.js drops the TS2339 errors against named typedefs from 17 to 1 (the remaining one is a `Editor | PresentationEditor` narrowing issue, not a typedef gap, and is in scope for SD-2867 phase 2). This PR ships the typedef-side fix only. Enrolling SuperDoc.js under the SD-2863 gate is tracked in SD-2867; ~137 unrelated errors (implicit-any, loose `Object` typedefs, strict-null) need dedicated cleanup before the gate enrollment. * fix(superdoc): correct three typedef shapes from PR3046 review (SD-2872) Codex review pass found three additions in the previous commit that did not match runtime behavior: - Document.role advertised a per-document override that does not exist. SuperDoc only writes `doc.role = config.role` internally; external collaboration overwrites it. Customers who set it on a per-document basis would see their value silently replaced. Removed the typedef. - Modules.whiteboard rejected the `false` disable sentinel that use-whiteboard.js explicitly checks (`config === false`). Widened the type to `false | { enabled?: boolean }` so the runtime-supported shape compiles. - Config.onFontsResolved typed the payload as `{ editor }`. The editor actually emits `{ documentFonts, unsupportedFonts }` (FontsResolvedPayload). Aligned with the public type already exported from `@superdoc/super-editor`.
1 parent e6b36ca commit 9045a26

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • packages/superdoc/src/core/types

packages/superdoc/src/core/types/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @property {string} name The user's name
44
* @property {string} email The user's email
55
* @property {string | null} [image] The user's photo
6+
* @property {string} [color] Awareness color for collaborative cursors. Auto-assigned from the configured palette (or a default palette) when omitted, derived from a hash of the user's identity so the assignment is stable across reloads.
67
*/
78

89
/**
@@ -536,6 +537,7 @@
536537
* @property {Object} [slashMenu] Deprecated. Use contextMenu instead.
537538
* @property {SurfacesModuleConfig} [surfaces] Surface system configuration
538539
* @property {TrackChangesModuleConfig} [trackChanges] Track changes module configuration
540+
* @property {false | { enabled?: boolean }} [whiteboard] Whiteboard module configuration. Pass `false` to disable the module entirely; pass an object to opt in (with `enabled: true`) or to keep it registered but inert (`enabled: false`, the default when no field is set).
539541
*/
540542

541543
/**
@@ -628,6 +630,11 @@
628630
* @property {Object} [semanticOptions] Internal-only semantic mode tuning options.
629631
* This shape is intentionally not a stable public API in v1.
630632
* @property {Object} [trackedChanges] Deprecated. Use `modules.trackChanges` instead. Optional override for paginated track-changes rendering (e.g., `{ mode: 'original' }` or `{ enabled: false }`).
633+
* @property {Object} [virtualization] Page virtualization options for paginated layout. Defaults to `{ enabled: true, window: 5, overscan: 1 }` to render only the visible window of pages plus a small overscan buffer.
634+
* @property {boolean} [virtualization.enabled] Whether virtualization is active (default: true)
635+
* @property {number} [virtualization.window] Number of pages kept rendered around the active page (default: 5)
636+
* @property {number} [virtualization.overscan] Extra pages rendered outside the active window for smoother scrolling (default: 1)
637+
* @property {boolean} [showBookmarks] Whether bookmark indicators are shown in the rendered layout. Toggleable at runtime via `superdoc.setShowBookmarks()`.
631638
*/
632639

633640
/**
@@ -725,6 +732,9 @@
725732
* @property {string} [licenseKey] License key for organization identification
726733
* @property {SuperDocTelemetryConfig} [telemetry] Telemetry configuration
727734
* @property {ProofingConfig} [proofing] Proofing / spellcheck configuration
735+
* @property {boolean} [useLayoutEngine] Opt-in toggle for the layout engine. Auto-disabled when web layout is requested without `layoutEngineOptions.flowMode === 'semantic'`; the loader logs a warning and falls back to the legacy ProseMirror render path in that case.
736+
* @property {(payload: import('@superdoc/super-editor').FontsResolvedPayload) => void} [onFontsResolved] Callback fired after the editor reports `fonts-resolved`. The payload contains `documentFonts` and `unsupportedFonts` arrays so hosts can fall back, warn, or block printing on unsupported faces.
737+
* @property {import('@hocuspocus/provider').HocuspocusProviderWebsocket} [socket] Internal: the shared websocket instance created by SuperDoc when `modules.collaboration.providerType === 'hocuspocus'`. Set automatically; do not pass from outside.
728738
*/
729739

730740
/**

0 commit comments

Comments
 (0)