Skip to content

Commit 0016073

Browse files
authored
feat(superdoc): declare SuperDoc implements SuperDocLike (SD-2917) (#3089)
createSuperDocUI({ superdoc }) accepts the structural SuperDocLike shape from superdoc/ui. Without an explicit @implements on the concrete class, consumers had to cast the SuperDoc instance every time at the package boundary because the type system can't connect the two on its own. Add a JSDoc @implements tag and a typedef import so the generated .d.ts declares the relationship, and consumers can drop the 'as unknown as ...' cast from the very first line of any framework adapter or example.
1 parent 887ee2a commit 0016073

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/superdoc/src/core/SuperDoc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const DEFAULT_AWARENESS_PALETTE = Object.freeze([
7373
* @typedef {import('./types/index.js').SurfaceHandle<T>} SurfaceHandle
7474
*/
7575
/** @typedef {import('./types/index.js').NavigableAddress} NavigableAddress */
76+
/** @typedef {import('@superdoc/super-editor/ui').SuperDocLike} SuperDocLike */
7677

7778
/**
7879
* Config callbacks are optional on the public typedef because consumers do
@@ -99,6 +100,7 @@ function asEventListener(listener) {
99100
*
100101
* @class
101102
* @extends EventEmitter
103+
* @implements {SuperDocLike}
102104
*/
103105
export class SuperDoc extends EventEmitter {
104106
/** @type {Array<string>} */

0 commit comments

Comments
 (0)