Specified more exact types for fetching bookmark data#26651
Specified more exact types for fetching bookmark data#26651
Conversation
no ref This types-only change should have no user impact.
WalkthroughThe pull request updates the JSDoc return type annotation for the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/core/core/server/services/oembed/oembed-service.js (1)
261-274: Document thetypeparameter in this JSDoc block for full signature parity.
fetchBookmarkData(url, html, type)still has an undocumented third param, which weakens the goal of exact typing.✏️ Suggested JSDoc adjustment
/** * `@param` {string} url * `@param` {string} html + * `@param` {'bookmark'|'mention'|undefined} [type] * * `@returns` {Promise<{ * version: '1.0', * type: 'bookmark', * url: string, * metadata: Omit<import('metascraper').Metadata, 'image'|'logo'> & { * thumbnail?: string, * icon?: string * } * }>} */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/core/core/server/services/oembed/oembed-service.js` around lines 261 - 274, Add a JSDoc `@param` entry for the undocumented third parameter `type` on the fetchBookmarkData function so the signature is fully described; update the block above async fetchBookmarkData(url, html, type) to include something like `@param` {string} type - the oEmbed type/variant (e.g., 'bookmark') and optionally enumerate allowed values or expected effect on returned metadata so tooling and readers have full parity with the function signature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/core/core/server/services/oembed/oembed-service.js`:
- Around line 261-274: Add a JSDoc `@param` entry for the undocumented third
parameter `type` on the fetchBookmarkData function so the signature is fully
described; update the block above async fetchBookmarkData(url, html, type) to
include something like `@param` {string} type - the oEmbed type/variant (e.g.,
'bookmark') and optionally enumerate allowed values or expected effect on
returned metadata so tooling and readers have full parity with the function
signature.
no ref
This types-only change should have no user impact.