Skip to content

Commit 73afdb6

Browse files
authored
refactor(superdoc): type createSuperdocVueApp return shape (SD-2867 phase B) (#3057)
`createSuperdocVueApp()` returned `Object` per its JSDoc, so the five fields SuperDoc.js destructures from the call (`app`, `pinia`, `superdocStore`, `commentsStore`, `highContrastModeStore`) all resolved to `Object` for any consumer enabling `// @ts-check`. Five TS2339 'Property does not exist on type Object' errors at SuperDoc.js line 464 — and inside the SD-2867 ratchet that turns each into a gate failure. Promotes the return type to a named `SuperdocVueAppRefs` typedef that imports `vue.App`, `pinia.Pinia`, and the store types via `ReturnType<typeof useSuperdocStore>` etc. The shape is internal-only (this typedef is not on the public Modules / Config surface), so adding it here doesn't widen the customer-visible surface. Verified: pnpm --filter superdoc run check:jsdoc passes (3 gated files clean); the consumer-typecheck matrix passes 31/31; the postbuild declaration audit reports no FAIL findings; pnpm --filter superdoc test passes 944/944. This is groundwork for SD-2867 phase B: closing each cluster of SuperDoc.js TS errors so the file can eventually enroll in `CHECKED_FILES`. Five errors closed; ~133 remain across implicit-any params, strict-null guards, and other type-not-assignable callsites. Each cluster will land as its own focused commit.
1 parent 7bf0fa7 commit 73afdb6

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

packages/superdoc/src/core/create-app.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,24 @@ const setPiniaDevtoolsSuppressedForApp = (app, isSuppressed) => {
301301
};
302302
};
303303

304+
/**
305+
* Result of `createSuperdocVueApp()`. Internal-only: the shape is consumed
306+
* by `SuperDoc.#initVueApp` and is not part of the public surface.
307+
*
308+
* @typedef {Object} SuperdocVueAppRefs
309+
* @property {import('vue').App} app The Vue 3 app instance
310+
* @property {import('pinia').Pinia} pinia The Pinia store instance attached to `app`
311+
* @property {ReturnType<typeof useSuperdocStore>} superdocStore The SuperDoc Pinia store
312+
* @property {ReturnType<typeof useCommentsStore>} commentsStore The Comments Pinia store
313+
* @property {ReturnType<typeof useHighContrastMode>} highContrastModeStore The high-contrast mode composable refs (`isHighContrastMode`, `setHighContrastMode`). Named `*Store` for historical reasons; this is a plain Vue composable, not a Pinia store.
314+
*/
315+
304316
/**
305317
* Generate the superdoc vue app
306318
*
307319
* @param {Object} [options]
308320
* @param {boolean} [options.disablePiniaDevtools=false] Disable Pinia devtools registration for this app instance
309-
* @returns {Object} An object containing the vue app, the pinia reference, and the superdoc store
321+
* @returns {SuperdocVueAppRefs} An object containing the vue app, the pinia reference, the superdoc/comments Pinia stores, and the high-contrast mode composable
310322
*/
311323
export const createSuperdocVueApp = ({ disablePiniaDevtools = false } = {}) => {
312324
const app = createApp(App);

0 commit comments

Comments
 (0)