Skip to content

Commit 0377afb

Browse files
committed
fix: use type args in jsx props multi space rule
1 parent da67123 commit 0377afb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/rules/jsx-props-no-multi-spaces.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,18 @@ module.exports = {
9898
}
9999

100100
function containsGenericType(node) {
101-
const containsTypeParams = typeof node.typeParameters !== 'undefined';
102-
return containsTypeParams && node.typeParameters.type === 'TSTypeParameterInstantiation';
101+
const nodeType = node.typeArguments || node.typeParameters;
102+
if (typeof nodeType === 'undefined') {
103+
return false;
104+
}
105+
106+
return nodeType.type === 'TSTypeParameterInstantiation';
103107
}
104108

105109
function getGenericNode(node) {
106110
const name = node.name;
107111
if (containsGenericType(node)) {
108-
const type = node.typeParameters;
112+
const type = node.typeArguments || node.typeParameters;
109113

110114
return Object.assign(
111115
{},

0 commit comments

Comments
 (0)