From 8bd4f026de6d12f70896471122636800c9eb42bd 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/internal/webstreams/adapters.js | 2 +- lib/querystring.js | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/internal/blob.js b/lib/internal/blob.js index b4b3da8d604286..3ac1caf76df019 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -129,7 +129,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 92570fe4a99d7a..50729350053fe2 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -588,7 +588,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; @@ -701,7 +701,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/internal/webstreams/adapters.js b/lib/internal/webstreams/adapters.js index 5e01d6eb8eb9dd..6f0963cde15bba 100644 --- a/lib/internal/webstreams/adapters.js +++ b/lib/internal/webstreams/adapters.js @@ -578,7 +578,7 @@ function newReadableWritablePairFromDuplex(duplex) { * objectMode? : boolean, * signal? : AbortSignal, * }} [options] - * @returns + * @returns {Duplex} */ function newStreamDuplexFromReadableWritablePair(pair = {}, options = {}) { validateObject(pair, 'pair'); 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')