You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After SD-2880 published Config and SuperDocLayoutEngineOptions, two
fields the source explicitly marks as internal became reachable on the
public surface:
- Config.socket. 'Internal: ... do not pass from outside.' Set by
SuperDoc when modules.collaboration.providerType is 'hocuspocus';
a consumer who passes it from outside breaks the collaboration
setup.
- SuperDocLayoutEngineOptions.semanticOptions. 'Internal-only ...
intentionally not a stable public API in v1.' A consumer who
pins a shape couples themselves to behavior we may break.
Earlier attempts and why they were wrong:
1. stripInternal: true in superdoc's tsconfig. Review pass found
this would silently strip 100+ pre-existing @internal-tagged
fields across super-editor (ImageAttrs.id, ParagraphAttrs.paraId,
TableAttrs.sdBlockId, etc.) — a worse regression than the one
this PR closes.
2. Omit<...> at the typedef alias boundary in superdoc/src/index.js.
Review pass found this only narrowed the standalone Config alias.
The nested Config.layoutEngineOptions still reached the un-Omitted
SuperDocLayoutEngineOptions, and the SuperDoc constructor signature
still took the un-Omitted Config — so `new SuperDoc({ socket })`
and `{ layoutEngineOptions: { semanticOptions } }` still type-
checked.
This patch removes both fields from the source `Config` and
`SuperDocLayoutEngineOptions` interfaces in core/types/index.ts and
adds InternalConfig / InternalSuperDocLayoutEngineOptions extensions
for the runtime callsites that need the augmented shape (SuperDoc.js's
this.config.socket assignments, etc.). Public surface no longer carries
either field anywhere it can be reached.
Side fix surfaced by the same review: the JSDoc `@typedef
{import('./types').X}` form in core/SuperDoc.js and core/surface-manager.js
did not resolve under TypeScript's node16 module resolution. The published
constructor signature decayed to `any` for node16 consumers, and the
constructor probe (`new SuperDoc({ socket: undefined })`) silently
type-checked. Switched all 11 `import('./types')` usages to
`import('./types/index.js')` so the path resolves under both bundler
and node16.
The regression-net fixture under tests/consumer-typecheck/ now covers
all four reachable surfaces: standalone Config alias, standalone
SuperDocLayoutEngineOptions alias, nested Config.layoutEngineOptions,
and the SuperDoc constructor parameter. Each uses @ts-expect-error so
a regression on any path fails CI with TS2578 ("Unused @ts-expect-error
directive").
Verified: matrix passes 31/31; declaration audit reports no FAIL
findings; published .d.ts no longer references socket or
semanticOptions on any reachable public path.
0 commit comments