From 66c674d58afe2a779559d4e85d257f8a2302c217 Mon Sep 17 00:00:00 2001 From: HenryBrown0 <26250092+HenryBrown0@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:42:03 +0100 Subject: [PATCH] refactor: extract type parameters to var --- lib/rules/jsx-props-no-multi-spaces.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rules/jsx-props-no-multi-spaces.js b/lib/rules/jsx-props-no-multi-spaces.js index b0d34d59dd..b9cabafe32 100644 --- a/lib/rules/jsx-props-no-multi-spaces.js +++ b/lib/rules/jsx-props-no-multi-spaces.js @@ -98,8 +98,12 @@ module.exports = { } function containsGenericType(node) { - const containsTypeParams = typeof node.typeParameters !== 'undefined'; - return containsTypeParams && node.typeParameters.type === 'TSTypeParameterInstantiation'; + const nodeTypeParams = node.typeParameters; + if (typeof nodeTypeParams === 'undefined') { + return false; + } + + return nodeTypeParams.type === 'TSTypeParameterInstantiation'; } function getGenericNode(node) {