diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index ee939df065..6eec874a89 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -150,6 +150,9 @@ module.exports = { return; } param.properties.forEach((property) => { + if (property.type === 'RestElement') { + return; + } const type = property.value.type; const right = property.value.right; if (type !== 'AssignmentPattern') { diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index b68dafe534..0ef8a072f0 100644 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -3109,6 +3109,40 @@ ruleTester.run('prop-types', rule, { type StateProps = ReturnType type DispatchProps = ReturnType`, parser: parsers['@TYPESCRIPT_ESLINT'] + }, + { + code: ` + import React from 'react' + + interface Meta { + touched: boolean, + error: string; + } + + interface Props { + input: string, + meta: Meta, + cssClasses: object + } + const InputField = ({ input, meta: { touched, error }, cssClasses = {}, ...restProps }: Props) => { + restProps.className = cssClasses.base + + if (cssClasses.custom) { + restProps.className += 'cssClasses.custom' + } + if (touched && error) { + restProps.className += 'cssClasses.error' + } + + return( + + ) + } + export default InputField`, + parser: parsers['@TYPESCRIPT_ESLINT'] } ]) ),