Skip to content

Commit

Permalink
fix: check key exisits before accessing
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
HenryBrown0 and ljharb committed Sep 27, 2023
1 parent bcd12ac commit d08f761
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rules/function-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const UNNAMED_FUNCTION_TEMPLATES = {

function hasOneUnconstrainedTypeParam(node) {
const nodeTypeParams = node.typeParameters;
if (!nodeTypeParams) {
return false;
}

return nodeTypeParams.params.length === 1 && !nodeTypeParams.params[0].constraint;
return nodeTypeParams
&& nodeTypeParams.params
&& nodeTypeParams.params.length === 1
&& !nodeTypeParams.params[0].constraint;
}

function hasName(node) {
Expand Down

0 comments on commit d08f761

Please sign in to comment.