Content-Length: 259168 | pFad | http://github.com/jsx-eslint/eslint-plugin-react/commit/3e02d917a29fd58f0d66f99bb72b44730db461c2

1B Check for undefined before accessing `node.type_annotations` · jsx-eslint/eslint-plugin-react@3e02d91 · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jsx-eslint/eslint-plugin-react/commit/3e02d917a29fd58f0d66f99bb72b44730db461c2

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy