From 29cc3003c7649998ee74e3d42ca1ab7a6187e43a Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Tue, 7 May 2024 11:08:20 +0200 Subject: [PATCH] Fixed misc JSDoc types - nothing crazy, just fixing minor typing issues that I've come across --- ghost/core/core/frontend/services/routing/ParentRouter.js | 6 +++--- ghost/core/core/server/services/url/UrlService.js | 6 ++---- ghost/members-importer/lib/MembersCSVImporter.js | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ghost/core/core/frontend/services/routing/ParentRouter.js b/ghost/core/core/frontend/services/routing/ParentRouter.js index e36e3721f2..809092cf9d 100644 --- a/ghost/core/core/frontend/services/routing/ParentRouter.js +++ b/ghost/core/core/frontend/services/routing/ParentRouter.js @@ -56,7 +56,7 @@ class ParentRouter { /** * @description Helper function to find the site router in the express router stack. * @param {Object} req - * @returns {Express-Router} + * @returns {import('express').Router} * @private */ _getSiteRouter(req) { @@ -116,8 +116,8 @@ class ParentRouter { /** * @description Mount a router on a router (sub-routing) - * @param {String} path - * @param {Express-Router} router + * @param {String | import('express').Router} path + * @param {import('express').Router} [router] */ mountRouter(path, router) { if (arguments.length === 1) { diff --git a/ghost/core/core/server/services/url/UrlService.js b/ghost/core/core/server/services/url/UrlService.js index f9feebd6a8..c6ed4bb76b 100644 --- a/ghost/core/core/server/services/url/UrlService.js +++ b/ghost/core/core/server/services/url/UrlService.js @@ -219,14 +219,12 @@ class UrlService { * They would show localhost:2368/null/. * * @param {String} id - * @param {Object} options + * @param {Object} [options] * @param {Object} [options.absolute] * @param {Object} [options.withSubdirectory] * @returns {String} */ - getUrlByResourceId(id, options) { - options = options || {}; - + getUrlByResourceId(id, options = {}) { const obj = this.urls.getByResourceId(id); if (obj) { diff --git a/ghost/members-importer/lib/MembersCSVImporter.js b/ghost/members-importer/lib/MembersCSVImporter.js index 9bd79f7c11..f4dc988ce2 100644 --- a/ghost/members-importer/lib/MembersCSVImporter.js +++ b/ghost/members-importer/lib/MembersCSVImporter.js @@ -34,7 +34,7 @@ const DEFAULT_CSV_HEADER_MAPPING = { * @property {Function} getTimezone - function returning currently configured timezone * @property {() => Object} getMembersRepository - member model access instance for data access and manipulation * @property {() => Promise} getDefaultTier - async function returning default Member Tier - * @property {() => Promise} getTierByName - async function returning Member Tier by name + * @property {(string) => Promise} getTierByName - async function returning Member Tier by name * @property {Function} sendEmail - function sending an email * @property {(string) => boolean} isSet - Method checking if specific feature is enabled * @property {({job, offloaded, name}) => void} addJob - Method registering an async job