diff --git a/lib/util/propTypes.js b/lib/util/propTypes.js index 89be4d820b..c19978587c 100644 --- a/lib/util/propTypes.js +++ b/lib/util/propTypes.js @@ -290,7 +290,7 @@ module.exports = function propTypesInstructions(context, components, utils) { } // the game here is to find the type declaration in the code const candidateTypes = context.getSourceCode().ast.body.filter((item) => item.type === 'VariableDeclaration' && item.kind === 'type'); - const declarations = Array.prototype.flatMap(candidateTypes, (type) => type.declarations); + const declarations = flatMap(candidateTypes, (type) => type.declarations); // we tried to find either an interface or a type with the TypeReference name const typeDeclaration = declarations.find((dec) => dec.id.name === typeName);