Skip to content

[Bug]: Error react/prop-types , although the type has been specified #3521

Closed
@da-du

Description

@da-du

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

Error react/prop-types , although the type has been specified

this is error:

import React, { forwardRef, memo } from 'react';

interface Props1 {
    age: number;
}
export const Hello = memo(
    forwardRef(({ age }: Props1) => { // error: 'age' is missing in props validationeslint(react/prop-types)
        return <div>Hello {age}</div>;
    }),
);

but this is correct:

import React, { forwardRef, memo } from 'react';

interface Props1 {
    age: number;
}
const HelloTemp = forwardRef(({ age }: Props1) => {
    return <div>Hello {age}</div>;
});
export const Hello = memo(HelloTemp);

Expected Behavior

Expected no error

eslint-plugin-react version

v7.30.1

eslint version

v8.29.0

node version

v16.19.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions