From c776c7c5317d641631be978f7d1d80c99b86c761 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Dec 2021 14:53:17 -0800 Subject: [PATCH] lib: include return types in JSDoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add types to @returns JSDoc annotations where the type is missing. PR-URL: https://github.com/nodejs/node/pull/41130 Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- lib/internal/blob.js | 2 +- lib/internal/fs/utils.js | 2 +- lib/internal/modules/esm/resolve.js | 4 ++-- lib/internal/per_context/primordials.js | 2 +- lib/querystring.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/internal/blob.js b/lib/internal/blob.js index 2f88f1bbda333d..6c1388744b17d4 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -131,7 +131,7 @@ class Blob { * endings? : string, * type? : string, * }} [options] - * @returns + * @constructs {Blob} */ constructor(sources = [], options = {}) { emitExperimentalWarning('buffer.Blob'); diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index b0aeb8185e9aa8..66b5e39b0c0fc8 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -525,7 +525,7 @@ Stats.prototype._checkModeProperty = function(property) { /** * @param {Float64Array | BigUint64Array} stats * @param {number} offset - * @returns + * @returns {BigIntStats | Stats} */ function getStatsFromBinding(stats, offset = 0) { if (isBigUint64Array(stats)) { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 635efaa459d76f..1f89cda7dcff4c 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -609,7 +609,7 @@ function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, * @param {Exports} exports * @param {URL} packageJSONUrl * @param {string | URL | undefined} base - * @returns + * @returns {boolean} */ function isConditionalExportsMainSugar(exports, packageJSONUrl, base) { if (typeof exports === 'string' || ArrayIsArray(exports)) return true; @@ -724,7 +724,7 @@ function patternKeyCompare(a, b) { * @param {string} name * @param {string | URL | undefined} base * @param {Set} conditions - * @returns + * @returns {URL} */ function packageImportsResolve(name, base, conditions) { if (name === '#' || StringPrototypeStartsWith(name, '#/')) { diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index 4dfb4dea85ef2a..7558fd25bd4984 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -404,7 +404,7 @@ primordials.PromisePrototypeCatch = (thisPromise, onRejected) => * @param {Promise} thisPromise * @param {() => void) | undefined | null} onFinally The callback to execute * when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. + * @returns {Promise} A Promise for the completion of the callback. */ primordials.SafePromisePrototypeFinally = (thisPromise, onFinally) => // Wrapping on a new Promise is necessary to not expose the SafePromise diff --git a/lib/querystring.js b/lib/querystring.js index 5bcfa13a6a5b13..9bcc9be6cc4851 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -191,7 +191,7 @@ function stringifyPrimitive(v) { /** * @param {string | number | bigint | boolean} v * @param {(v: string) => string} encode - * @returns + * @returns {string} */ function encodeStringified(v, encode) { if (typeof v === 'string')