Skip to content

Commit 2cbbd23

Browse files
authored
feat(superdoc): export Config, Modules, and core/types public typedefs (SD-2880) (#3053)
The most fundamental shapes of the SuperDoc API were defined in source but unreachable through the published `superdoc` entry. Consumers writing TypeScript could not type their constructor input, their `modules` block, or any of the surface/prompt/find-replace configs without falling back to deep paths or `any`. This is the most direct manifestation of SD-2828's "no TypeScript errors for end users." Adds 40 typedef re-exports to `packages/superdoc/src/index.js`: - Config, Modules - CollaborationConfig, CollaborationProvider, UpgradeToCollaborationOptions - LinkPopoverContext, LinkPopoverResolver, LinkPopoverResolution, ExternalPopoverRenderContext - IntentSurfaceRequest, DirectSurfaceRequest, SurfaceRequest, SurfaceResolution, SurfaceResolver, SurfaceOutcome, SurfaceHandle, SurfaceComponentProps, ExternalSurfaceRenderContext, SurfacesModuleConfig, SurfaceMode, SurfaceFloatingPlacement - ResolvedPasswordPromptTexts, PasswordPromptAttemptResult, PasswordPromptHandle, PasswordPromptContext, PasswordPromptRenderContext, PasswordPromptResolution, PasswordPromptConfig - ResolvedFindReplaceTexts, FindReplaceHandle, FindReplaceContext, FindReplaceRenderContext, FindReplaceResolution, FindReplaceConfig - TrackChangesModuleConfig - ViewingVisibilityConfig, SuperDocLayoutEngineOptions - EditorSurface, EditorUpdateEvent, EditorTransactionEvent - ExportType, CommentsType, ExportParams - SuperDocTelemetryConfig The auto-derived assertion list (SD-2860) picks all 40 up automatically; each is now gated against `any` collapse via the consumer-typecheck matrix. Total assertions: 116 → 156. The pass-through fixture (SD-2869) switches from `ConstructorParameters<typeof SuperDoc>[0]` to a direct `Config` import. Skipped due to existing collisions: - User: a different `User` is already exported from `@superdoc/super-editor` (with name/email optional). The `core/types` `User` requires both. Resolving requires a separate decision on which is canonical; not in scope here. - Document: collides with the DOM `Document` global at consumer sites. Likely needs a rename (e.g. `SuperDocDocument`). Out of scope for this PR. - ViewLayout, ViewOptions: already re-exported from `@superdoc/super-editor`. - ProofingConfig, ProofingStatus, ProofingError: already re-exported from `@superdoc/super-editor`. Verified: `pnpm --filter superdoc run check:jsdoc` passes; the consumer matrix passes 29/29; the postbuild declaration audit reports no FAIL findings.
1 parent 2d6be5a commit 2cbbd23

4 files changed

Lines changed: 154 additions & 30 deletions

File tree

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type {
2323
CommentAddress as SuperEditorCommentAddress,
2424
TrackedChangeAddress as SuperEditorTrackedChangeAddress,
2525
NavigableAddress as SuperEditorNavigableAddress,
26+
CollaborationProvider as SuperEditorCollaborationProvider,
2627
FontConfig,
2728
FontsResolvedPayload,
2829
ProofingProvider,
@@ -79,24 +80,11 @@ export interface Document {
7980
/**
8081
* External collaboration provider interface. Accepts any Yjs-compatible
8182
* provider (HocuspocusProvider, LiveblocksYjsProvider, TiptapCollabProvider,
82-
* etc.).
83+
* etc.). Re-exported from `@superdoc/super-editor` so `Config.modules.collaboration.provider`
84+
* (typed against this) accepts values typed against the publicly-exported
85+
* `CollaborationProvider` from `superdoc`.
8386
*/
84-
export interface CollaborationProvider {
85-
/** The Yjs awareness instance (optional, may be null). */
86-
awareness?: object;
87-
/** Event listener. */
88-
on?: (event: string, handler: (...args: unknown[]) => unknown) => void;
89-
/** Event unsubscriber. */
90-
off?: (event: string, handler: (...args: unknown[]) => unknown) => void;
91-
/** Disconnect from the provider. */
92-
disconnect?: () => void;
93-
/** Destroy the provider. */
94-
destroy?: () => void;
95-
/** Whether the provider has synced. */
96-
synced?: boolean;
97-
/** Alternative sync property (used by some providers). */
98-
isSynced?: boolean;
99-
}
87+
export type CollaborationProvider = SuperEditorCollaborationProvider;
10088

10189
/** Collaboration module configuration. */
10290
export interface CollaborationConfig {

packages/superdoc/src/index.js

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ import { getSchemaIntrospection } from './helpers/schema-introspection.js';
4040

4141
// ============================================
4242
// TYPE RE-EXPORTS
43-
// These types are defined in @superdoc/super-editor and re-exported for consumers.
44-
// vite-plugin-dts picks up these JSDoc @typedef imports and generates
45-
// corresponding `export type` declarations in the consumer-facing .d.ts.
43+
// These types are defined in @superdoc/super-editor and ./core/types/, and
44+
// re-exported for consumers. vite-plugin-dts picks up these JSDoc @typedef
45+
// imports and generates corresponding `export type` declarations in the
46+
// consumer-facing .d.ts.
4647
// ============================================
4748

4849
/**
@@ -186,6 +187,47 @@ import { getSchemaIntrospection } from './helpers/schema-introspection.js';
186187
* @typedef {import('./core/types/index.js').CommentAddress} CommentAddress
187188
* @typedef {import('./core/types/index.js').TrackedChangeAddress} TrackedChangeAddress
188189
* @typedef {import('./core/types/index.js').NavigableAddress} NavigableAddress
190+
*
191+
* @typedef {import('./core/types/index.js').Config} Config
192+
* @typedef {import('./core/types/index.js').Modules} Modules
193+
* @typedef {import('./core/types/index.js').CollaborationConfig} CollaborationConfig
194+
* @typedef {import('./core/types/index.js').UpgradeToCollaborationOptions} UpgradeToCollaborationOptions
195+
* @typedef {import('./core/types/index.js').ExternalPopoverRenderContext} ExternalPopoverRenderContext
196+
* @typedef {import('./core/types/index.js').IntentSurfaceRequest} IntentSurfaceRequest
197+
* @typedef {import('./core/types/index.js').DirectSurfaceRequest} DirectSurfaceRequest
198+
* @typedef {import('./core/types/index.js').SurfaceRequest} SurfaceRequest
199+
* @typedef {import('./core/types/index.js').SurfaceResolution} SurfaceResolution
200+
* @typedef {import('./core/types/index.js').SurfaceResolver} SurfaceResolver
201+
* @typedef {import('./core/types/index.js').SurfaceOutcome} SurfaceOutcome
202+
* @typedef {import('./core/types/index.js').SurfaceHandle} SurfaceHandle
203+
* @typedef {import('./core/types/index.js').SurfaceComponentProps} SurfaceComponentProps
204+
* @typedef {import('./core/types/index.js').ExternalSurfaceRenderContext} ExternalSurfaceRenderContext
205+
* @typedef {import('./core/types/index.js').SurfacesModuleConfig} SurfacesModuleConfig
206+
* @typedef {import('./core/types/index.js').SurfaceMode} SurfaceMode
207+
* @typedef {import('./core/types/index.js').SurfaceFloatingPlacement} SurfaceFloatingPlacement
208+
* @typedef {import('./core/types/index.js').ResolvedPasswordPromptTexts} ResolvedPasswordPromptTexts
209+
* @typedef {import('./core/types/index.js').PasswordPromptAttemptResult} PasswordPromptAttemptResult
210+
* @typedef {import('./core/types/index.js').PasswordPromptHandle} PasswordPromptHandle
211+
* @typedef {import('./core/types/index.js').PasswordPromptContext} PasswordPromptContext
212+
* @typedef {import('./core/types/index.js').PasswordPromptRenderContext} PasswordPromptRenderContext
213+
* @typedef {import('./core/types/index.js').PasswordPromptResolution} PasswordPromptResolution
214+
* @typedef {import('./core/types/index.js').PasswordPromptConfig} PasswordPromptConfig
215+
* @typedef {import('./core/types/index.js').ResolvedFindReplaceTexts} ResolvedFindReplaceTexts
216+
* @typedef {import('./core/types/index.js').FindReplaceHandle} FindReplaceHandle
217+
* @typedef {import('./core/types/index.js').FindReplaceContext} FindReplaceContext
218+
* @typedef {import('./core/types/index.js').FindReplaceRenderContext} FindReplaceRenderContext
219+
* @typedef {import('./core/types/index.js').FindReplaceResolution} FindReplaceResolution
220+
* @typedef {import('./core/types/index.js').FindReplaceConfig} FindReplaceConfig
221+
* @typedef {import('./core/types/index.js').TrackChangesModuleConfig} TrackChangesModuleConfig
222+
* @typedef {import('./core/types/index.js').ViewingVisibilityConfig} ViewingVisibilityConfig
223+
* @typedef {import('./core/types/index.js').SuperDocLayoutEngineOptions} SuperDocLayoutEngineOptions
224+
* @typedef {import('./core/types/index.js').EditorSurface} EditorSurface
225+
* @typedef {import('./core/types/index.js').EditorUpdateEvent} EditorUpdateEvent
226+
* @typedef {import('./core/types/index.js').EditorTransactionEvent} EditorTransactionEvent
227+
* @typedef {import('./core/types/index.js').ExportType} ExportType
228+
* @typedef {import('./core/types/index.js').CommentsType} CommentsType
229+
* @typedef {import('./core/types/index.js').ExportParams} ExportParams
230+
* @typedef {import('./core/types/index.js').SuperDocTelemetryConfig} SuperDocTelemetryConfig
189231
*/
190232

191233
// Public exports

tests/consumer-typecheck/src/all-public-types.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
CanObject,
2525
ChainableCommandObject,
2626
ChainedCommand,
27+
CollaborationConfig,
2728
CollaborationProvider,
2829
Command,
2930
CommandProps,
@@ -33,11 +34,14 @@ import type {
3334
CommentElement,
3435
CommentLocationsPayload,
3536
CommentsPayload,
37+
CommentsType,
38+
Config,
3639
ContextMenuConfig,
3740
ContextMenuContext,
3841
ContextMenuItem,
3942
ContextMenuSection,
4043
CoreCommandMap,
44+
DirectSurfaceRequest,
4145
DocumentApi,
4246
DocumentMode,
4347
DocumentProtectionState,
@@ -48,19 +52,32 @@ import type {
4852
EditorLifecycleState,
4953
EditorOptions,
5054
EditorState,
55+
EditorSurface,
56+
EditorTransactionEvent,
57+
EditorUpdateEvent,
5158
EditorView,
5259
EntityAddress,
5360
ExportDocxParams,
5461
ExportFormat,
5562
ExportOptions,
63+
ExportParams,
64+
ExportType,
5665
ExtensionCommandMap,
66+
ExternalPopoverRenderContext,
67+
ExternalSurfaceRenderContext,
5768
FieldValue,
69+
FindReplaceConfig,
70+
FindReplaceContext,
71+
FindReplaceHandle,
72+
FindReplaceRenderContext,
73+
FindReplaceResolution,
5874
FlowBlock,
5975
FlowMode,
6076
FontConfig,
6177
FontsResolvedPayload,
6278
ImageDeselectedEvent,
6379
ImageSelectedEvent,
80+
IntentSurfaceRequest,
6481
Layout,
6582
LayoutEngineOptions,
6683
LayoutError,
@@ -75,6 +92,7 @@ import type {
7592
LinkPopoverResolver,
7693
ListDefinitionsPayload,
7794
Measure,
95+
Modules,
7896
NavigableAddress,
7997
OpenOptions,
8098
PageMargins,
@@ -85,6 +103,12 @@ import type {
85103
PartChangedEvent,
86104
PartId,
87105
PartSectionId,
106+
PasswordPromptAttemptResult,
107+
PasswordPromptConfig,
108+
PasswordPromptContext,
109+
PasswordPromptHandle,
110+
PasswordPromptRenderContext,
111+
PasswordPromptResolution,
88112
PermissionParams,
89113
PositionHit,
90114
PresenceOptions,
@@ -107,6 +131,8 @@ import type {
107131
RemoteCursorsRenderPayload,
108132
RemoteUserInfo,
109133
ResolveRangeOutput,
134+
ResolvedFindReplaceTexts,
135+
ResolvedPasswordPromptTexts,
110136
SaveOptions,
111137
Schema,
112138
ScrollIntoViewInput,
@@ -118,18 +144,32 @@ import type {
118144
SelectionHandle,
119145
SelectionInfo,
120146
StoryLocator,
147+
SuperDocLayoutEngineOptions,
148+
SuperDocTelemetryConfig,
149+
SurfaceComponentProps,
150+
SurfaceFloatingPlacement,
151+
SurfaceHandle,
152+
SurfaceMode,
153+
SurfaceOutcome,
154+
SurfaceRequest,
155+
SurfaceResolution,
156+
SurfaceResolver,
157+
SurfacesModuleConfig,
121158
TelemetryEvent,
122159
TextAddress,
123160
TextSegment,
124161
TextTarget,
162+
TrackChangesModuleConfig,
125163
TrackedChangeAddress,
126164
TrackedChangesMode,
127165
TrackedChangesOverrides,
128166
Transaction,
129167
UnsupportedContentItem,
168+
UpgradeToCollaborationOptions,
130169
User,
131170
ViewLayout,
132171
ViewOptions,
172+
ViewingVisibilityConfig,
133173
VirtualizationOptions,
134174
} from 'superdoc';
135175

@@ -149,6 +189,7 @@ const _real_BoundingRect: AssertNotAny<BoundingRect> = true;
149189
const _real_CanObject: AssertNotAny<CanObject> = true;
150190
const _real_ChainableCommandObject: AssertNotAny<ChainableCommandObject> = true;
151191
const _real_ChainedCommand: AssertNotAny<ChainedCommand> = true;
192+
const _real_CollaborationConfig: AssertNotAny<CollaborationConfig> = true;
152193
const _real_CollaborationProvider: AssertNotAny<CollaborationProvider> = true;
153194
const _real_Command: AssertNotAny<Command> = true;
154195
const _real_CommandProps: AssertNotAny<CommandProps> = true;
@@ -158,11 +199,14 @@ const _real_CommentConfig: AssertNotAny<CommentConfig> = true;
158199
const _real_CommentElement: AssertNotAny<CommentElement> = true;
159200
const _real_CommentLocationsPayload: AssertNotAny<CommentLocationsPayload> = true;
160201
const _real_CommentsPayload: AssertNotAny<CommentsPayload> = true;
202+
const _real_CommentsType: AssertNotAny<CommentsType> = true;
203+
const _real_Config: AssertNotAny<Config> = true;
161204
const _real_ContextMenuConfig: AssertNotAny<ContextMenuConfig> = true;
162205
const _real_ContextMenuContext: AssertNotAny<ContextMenuContext> = true;
163206
const _real_ContextMenuItem: AssertNotAny<ContextMenuItem> = true;
164207
const _real_ContextMenuSection: AssertNotAny<ContextMenuSection> = true;
165208
const _real_CoreCommandMap: AssertNotAny<CoreCommandMap> = true;
209+
const _real_DirectSurfaceRequest: AssertNotAny<DirectSurfaceRequest> = true;
166210
const _real_DocumentApi: AssertNotAny<DocumentApi> = true;
167211
const _real_DocumentMode: AssertNotAny<DocumentMode> = true;
168212
const _real_DocumentProtectionState: AssertNotAny<DocumentProtectionState> = true;
@@ -173,19 +217,32 @@ const _real_EditorExtension: AssertNotAny<EditorExtension> = true;
173217
const _real_EditorLifecycleState: AssertNotAny<EditorLifecycleState> = true;
174218
const _real_EditorOptions: AssertNotAny<EditorOptions> = true;
175219
const _real_EditorState: AssertNotAny<EditorState> = true;
220+
const _real_EditorSurface: AssertNotAny<EditorSurface> = true;
221+
const _real_EditorTransactionEvent: AssertNotAny<EditorTransactionEvent> = true;
222+
const _real_EditorUpdateEvent: AssertNotAny<EditorUpdateEvent> = true;
176223
const _real_EditorView: AssertNotAny<EditorView> = true;
177224
const _real_EntityAddress: AssertNotAny<EntityAddress> = true;
178225
const _real_ExportDocxParams: AssertNotAny<ExportDocxParams> = true;
179226
const _real_ExportFormat: AssertNotAny<ExportFormat> = true;
180227
const _real_ExportOptions: AssertNotAny<ExportOptions> = true;
228+
const _real_ExportParams: AssertNotAny<ExportParams> = true;
229+
const _real_ExportType: AssertNotAny<ExportType> = true;
181230
const _real_ExtensionCommandMap: AssertNotAny<ExtensionCommandMap> = true;
231+
const _real_ExternalPopoverRenderContext: AssertNotAny<ExternalPopoverRenderContext> = true;
232+
const _real_ExternalSurfaceRenderContext: AssertNotAny<ExternalSurfaceRenderContext> = true;
182233
const _real_FieldValue: AssertNotAny<FieldValue> = true;
234+
const _real_FindReplaceConfig: AssertNotAny<FindReplaceConfig> = true;
235+
const _real_FindReplaceContext: AssertNotAny<FindReplaceContext> = true;
236+
const _real_FindReplaceHandle: AssertNotAny<FindReplaceHandle> = true;
237+
const _real_FindReplaceRenderContext: AssertNotAny<FindReplaceRenderContext> = true;
238+
const _real_FindReplaceResolution: AssertNotAny<FindReplaceResolution> = true;
183239
const _real_FlowBlock: AssertNotAny<FlowBlock> = true;
184240
const _real_FlowMode: AssertNotAny<FlowMode> = true;
185241
const _real_FontConfig: AssertNotAny<FontConfig> = true;
186242
const _real_FontsResolvedPayload: AssertNotAny<FontsResolvedPayload> = true;
187243
const _real_ImageDeselectedEvent: AssertNotAny<ImageDeselectedEvent> = true;
188244
const _real_ImageSelectedEvent: AssertNotAny<ImageSelectedEvent> = true;
245+
const _real_IntentSurfaceRequest: AssertNotAny<IntentSurfaceRequest> = true;
189246
const _real_Layout: AssertNotAny<Layout> = true;
190247
const _real_LayoutEngineOptions: AssertNotAny<LayoutEngineOptions> = true;
191248
const _real_LayoutError: AssertNotAny<LayoutError> = true;
@@ -200,6 +257,7 @@ const _real_LinkPopoverResolution: AssertNotAny<LinkPopoverResolution> = true;
200257
const _real_LinkPopoverResolver: AssertNotAny<LinkPopoverResolver> = true;
201258
const _real_ListDefinitionsPayload: AssertNotAny<ListDefinitionsPayload> = true;
202259
const _real_Measure: AssertNotAny<Measure> = true;
260+
const _real_Modules: AssertNotAny<Modules> = true;
203261
const _real_NavigableAddress: AssertNotAny<NavigableAddress> = true;
204262
const _real_OpenOptions: AssertNotAny<OpenOptions> = true;
205263
const _real_PageMargins: AssertNotAny<PageMargins> = true;
@@ -210,6 +268,12 @@ const _real_PaintSnapshot: AssertNotAny<PaintSnapshot> = true;
210268
const _real_PartChangedEvent: AssertNotAny<PartChangedEvent> = true;
211269
const _real_PartId: AssertNotAny<PartId> = true;
212270
const _real_PartSectionId: AssertNotAny<PartSectionId> = true;
271+
const _real_PasswordPromptAttemptResult: AssertNotAny<PasswordPromptAttemptResult> = true;
272+
const _real_PasswordPromptConfig: AssertNotAny<PasswordPromptConfig> = true;
273+
const _real_PasswordPromptContext: AssertNotAny<PasswordPromptContext> = true;
274+
const _real_PasswordPromptHandle: AssertNotAny<PasswordPromptHandle> = true;
275+
const _real_PasswordPromptRenderContext: AssertNotAny<PasswordPromptRenderContext> = true;
276+
const _real_PasswordPromptResolution: AssertNotAny<PasswordPromptResolution> = true;
213277
const _real_PermissionParams: AssertNotAny<PermissionParams> = true;
214278
const _real_PositionHit: AssertNotAny<PositionHit> = true;
215279
const _real_PresenceOptions: AssertNotAny<PresenceOptions> = true;
@@ -232,6 +296,8 @@ const _real_RemoteCursorState: AssertNotAny<RemoteCursorState> = true;
232296
const _real_RemoteCursorsRenderPayload: AssertNotAny<RemoteCursorsRenderPayload> = true;
233297
const _real_RemoteUserInfo: AssertNotAny<RemoteUserInfo> = true;
234298
const _real_ResolveRangeOutput: AssertNotAny<ResolveRangeOutput> = true;
299+
const _real_ResolvedFindReplaceTexts: AssertNotAny<ResolvedFindReplaceTexts> = true;
300+
const _real_ResolvedPasswordPromptTexts: AssertNotAny<ResolvedPasswordPromptTexts> = true;
235301
const _real_SaveOptions: AssertNotAny<SaveOptions> = true;
236302
const _real_Schema: AssertNotAny<Schema> = true;
237303
const _real_ScrollIntoViewInput: AssertNotAny<ScrollIntoViewInput> = true;
@@ -243,16 +309,30 @@ const _real_SelectionCurrentInput: AssertNotAny<SelectionCurrentInput> = true;
243309
const _real_SelectionHandle: AssertNotAny<SelectionHandle> = true;
244310
const _real_SelectionInfo: AssertNotAny<SelectionInfo> = true;
245311
const _real_StoryLocator: AssertNotAny<StoryLocator> = true;
312+
const _real_SuperDocLayoutEngineOptions: AssertNotAny<SuperDocLayoutEngineOptions> = true;
313+
const _real_SuperDocTelemetryConfig: AssertNotAny<SuperDocTelemetryConfig> = true;
314+
const _real_SurfaceComponentProps: AssertNotAny<SurfaceComponentProps> = true;
315+
const _real_SurfaceFloatingPlacement: AssertNotAny<SurfaceFloatingPlacement> = true;
316+
const _real_SurfaceHandle: AssertNotAny<SurfaceHandle> = true;
317+
const _real_SurfaceMode: AssertNotAny<SurfaceMode> = true;
318+
const _real_SurfaceOutcome: AssertNotAny<SurfaceOutcome> = true;
319+
const _real_SurfaceRequest: AssertNotAny<SurfaceRequest> = true;
320+
const _real_SurfaceResolution: AssertNotAny<SurfaceResolution> = true;
321+
const _real_SurfaceResolver: AssertNotAny<SurfaceResolver> = true;
322+
const _real_SurfacesModuleConfig: AssertNotAny<SurfacesModuleConfig> = true;
246323
const _real_TelemetryEvent: AssertNotAny<TelemetryEvent> = true;
247324
const _real_TextAddress: AssertNotAny<TextAddress> = true;
248325
const _real_TextSegment: AssertNotAny<TextSegment> = true;
249326
const _real_TextTarget: AssertNotAny<TextTarget> = true;
327+
const _real_TrackChangesModuleConfig: AssertNotAny<TrackChangesModuleConfig> = true;
250328
const _real_TrackedChangeAddress: AssertNotAny<TrackedChangeAddress> = true;
251329
const _real_TrackedChangesMode: AssertNotAny<TrackedChangesMode> = true;
252330
const _real_TrackedChangesOverrides: AssertNotAny<TrackedChangesOverrides> = true;
253331
const _real_Transaction: AssertNotAny<Transaction> = true;
254332
const _real_UnsupportedContentItem: AssertNotAny<UnsupportedContentItem> = true;
333+
const _real_UpgradeToCollaborationOptions: AssertNotAny<UpgradeToCollaborationOptions> = true;
255334
const _real_User: AssertNotAny<User> = true;
256335
const _real_ViewLayout: AssertNotAny<ViewLayout> = true;
257336
const _real_ViewOptions: AssertNotAny<ViewOptions> = true;
337+
const _real_ViewingVisibilityConfig: AssertNotAny<ViewingVisibilityConfig> = true;
258338
const _real_VirtualizationOptions: AssertNotAny<VirtualizationOptions> = true;

tests/consumer-typecheck/src/modules-config-passthrough.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,13 @@
1616
* keys forwarded to SuperToolbar via `...moduleConfig`.
1717
* - SD-2869 review pass flagged `onAwarenessUpdate.states` narrowed from
1818
* JSDoc `Array` (= `any[]`) to `unknown[]`.
19-
*
20-
* Note: `Config`, `Modules`, `FindReplaceConfig`, and `PasswordPromptConfig`
21-
* are not yet exported from the public `superdoc` surface — a separate
22-
* follow-up ticket. This fixture works around that by typing the config
23-
* literal off the SuperDoc constructor parameter, which is reachable.
2419
*/
25-
import { SuperDoc } from 'superdoc';
26-
27-
type SuperDocConfig = ConstructorParameters<typeof SuperDoc>[0];
20+
import type { Config } from 'superdoc';
2821

2922
// A realistic config with the documented fields plus the pass-through extras
3023
// the runtime accepts. If any of these stops compiling under strict mode,
3124
// existing consumer code regresses.
32-
const config: SuperDocConfig = {
25+
const config: Config = {
3326
selector: '#editor',
3427

3528
modules: {
@@ -146,8 +139,29 @@ const config: SuperDocConfig = {
146139
void config;
147140

148141
// Whiteboard accepts the structured form too.
149-
const enabledWhiteboard: SuperDocConfig = {
142+
const enabledWhiteboard: Config = {
150143
selector: '#editor',
151144
modules: { whiteboard: { enabled: true } },
152145
};
153146
void enabledWhiteboard;
147+
148+
// CollaborationProvider interop: a value typed as the publicly-exported
149+
// CollaborationProvider must be assignable to Config.modules.collaboration.provider
150+
// (also typed against CollaborationProvider). Pre-SD-2880 these were two
151+
// different shapes — super-editor's allowed `awareness: null`, core/types'
152+
// did not — and a strict-mode consumer setting both at once got an error.
153+
import type { CollaborationProvider } from 'superdoc';
154+
155+
const provider: CollaborationProvider = {
156+
awareness: null,
157+
on(event, handler) {
158+
void event;
159+
void handler;
160+
},
161+
};
162+
163+
const collabConfig: Config = {
164+
selector: '#editor',
165+
modules: { collaboration: { provider } },
166+
};
167+
void collabConfig;

0 commit comments

Comments
 (0)