Skip to content

Commit d08f761

Browse files
HenryBrown0ljharb
andcommitted
fix: check key exisits before accessing
Co-authored-by: Jordan Harband <[email protected]>
1 parent bcd12ac commit d08f761

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/rules/function-component-definition.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ const UNNAMED_FUNCTION_TEMPLATES = {
3434

3535
function hasOneUnconstrainedTypeParam(node) {
3636
const nodeTypeParams = node.typeParameters;
37-
if (!nodeTypeParams) {
38-
return false;
39-
}
4037

41-
return nodeTypeParams.params.length === 1 && !nodeTypeParams.params[0].constraint;
38+
return nodeTypeParams
39+
&& nodeTypeParams.params
40+
&& nodeTypeParams.params.length === 1
41+
&& !nodeTypeParams.params[0].constraint;
4242
}
4343

4444
function hasName(node) {

0 commit comments

Comments
 (0)