SD-2261 - fix(types): expand definitions and exports to pass compilation#2463
SD-2261 - fix(types): expand definitions and exports to pass compilation#2463mattConnHarbour wants to merge 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3860e18fa4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| replaceFile(newFile: File | Blob | BinaryData): Promise<void>; | ||
|
|
There was a problem hiding this comment.
Remove unsupported PresentationEditor methods
The public PresentationEditor class in packages/super-editor/src/core/presentation-editor/PresentationEditor.ts does not implement replaceFile() or setToolbar() at all (a repo-wide search only finds those members on Editor), so this declaration will make TypeScript consumers compile successfully and then crash with TypeError when they call the newly advertised API.
Useful? React with 👍 / 👎.
| exportDocument(options?: { | ||
| isFinalDoc?: boolean; | ||
| commentsType?: string; | ||
| comments?: Comment[]; | ||
| }): Promise<Blob | ArrayBuffer>; |
There was a problem hiding this comment.
Preserve Node Buffer in export return types
For headless/Node consumers, Editor.exportDocument() still resolves to a Buffer (Editor.ts returns Promise<Blob | Buffer>, and the Node export tests assert Buffer.isBuffer(exported)). Narrowing the declaration to Blob | ArrayBuffer breaks the common fs.writeFile(await editor.exportDocument()) flow at compile time even though runtime behavior is unchanged; exportDocx() immediately above has the same regression.
Useful? React with 👍 / 👎.
| /** | ||
| * Save the document to the original source path (Node.js only). | ||
| */ | ||
| save(options?: { isFinalDoc?: boolean; commentsType?: string; comments?: Comment[] }): Promise<void>; |
There was a problem hiding this comment.
Keep save/export options aligned with SaveOptions
Editor.ts's SaveOptions already includes fieldsHighlightColor and compression, and save(), saveTo(), and exportDocument() all forward those flags into exportDocx(). After this narrowing, any TypeScript consumer using custom field highlighting or compression: 'STORE' will start failing to compile even though the feature still works at runtime.
Useful? React with 👍 / 👎.
No description provided.