Skip to content

Commit 3e02d91

Browse files
authored
Check for undefined before accessing node.type_annotations
1 parent 51d342b commit 3e02d91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rules/sort-prop-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ module.exports = {
230230
}
231231

232232
function handleFunctionComponent(node) {
233-
const firstArg = node.params[0].typeAnnotation && node.params[0].typeAnnotation.typeAnnotation;
233+
const firstArg = node.params && node.params.length > 0 && node.params[0].typeAnnotation && node.params[0].typeAnnotation.typeAnnotation;
234234
if (firstArg && firstArg.type === 'TSTypeReference') {
235235
const propType = typeAnnotations.get(firstArg.typeName.name)
236236
&& typeAnnotations.get(firstArg.typeName.name)[0];

0 commit comments

Comments
 (0)