From 791599b7f19cc0dbaf457dff612377fa5b41e7b3 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 12 Dec 2019 09:51:50 +0100 Subject: [PATCH] Type is-shallow-equal --- packages/is-shallow-equal/arrays.js | 4 ++-- packages/is-shallow-equal/index.js | 8 ++++++-- packages/is-shallow-equal/objects.js | 4 ++-- tsconfig.json | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/is-shallow-equal/arrays.js b/packages/is-shallow-equal/arrays.js index 950224a8c8c50..6937373a98546 100644 --- a/packages/is-shallow-equal/arrays.js +++ b/packages/is-shallow-equal/arrays.js @@ -3,8 +3,8 @@ /** * Returns true if the two arrays are shallow equal, or false otherwise. * - * @param {Array} a First array to compare. - * @param {Array} b Second array to compare. + * @param {any[]} a First array to compare. + * @param {any[]} b Second array to compare. * * @return {boolean} Whether the two arrays are shallow equal. */ diff --git a/packages/is-shallow-equal/index.js b/packages/is-shallow-equal/index.js index f24dd1ea07a90..dc9c074f8327e 100644 --- a/packages/is-shallow-equal/index.js +++ b/packages/is-shallow-equal/index.js @@ -8,12 +8,16 @@ var isShallowEqualArrays = require( './arrays' ); var isArray = Array.isArray; +/** + * @typedef {{[key: string]: any}} ComparableObject + */ + /** * Returns true if the two arrays or objects are shallow equal, or false * otherwise. * - * @param {(Array|Object)} a First object or array to compare. - * @param {(Array|Object)} b Second object or array to compare. + * @param {any[]|ComparableObject} a First object or array to compare. + * @param {any[]|ComparableObject} b Second object or array to compare. * * @return {boolean} Whether the two values are shallow equal. */ diff --git a/packages/is-shallow-equal/objects.js b/packages/is-shallow-equal/objects.js index ebe1105b19615..2c7583aba9ce1 100644 --- a/packages/is-shallow-equal/objects.js +++ b/packages/is-shallow-equal/objects.js @@ -5,8 +5,8 @@ var keys = Object.keys; /** * Returns true if the two objects are shallow equal, or false otherwise. * - * @param {Object} a First object to compare. - * @param {Object} b Second object to compare. + * @param {import('.').ComparableObject} a First object to compare. + * @param {import('.').ComparableObject} b Second object to compare. * * @return {boolean} Whether the two objects are shallow equal. */ diff --git a/tsconfig.json b/tsconfig.json index 46e4b01c2bc0b..4b39b208ad31b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,6 +23,7 @@ }, "include": [ "./packages/i18n/**/*.js", + "./packages/is-shallow-equal/**/*.js", "./packages/priority-queue/**/*.js", "./packages/token-list/**/*.js", "./packages/url/**/*.js"