Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/no-unused-prop-types false positive when defining type of destructured props [TS] #2689

Closed
Winggo opened this issue Jun 30, 2020 · 3 comments · Fixed by #2690
Closed

Comments

@Winggo
Copy link

Winggo commented Jun 30, 2020

example1:

const profileState = useSelector(
  ({ profile }:
   { profile: ProfileState }) => // 'profile' PropType is defined but prop is never used eslint(react/no-unused-prop-types)
     profile,
);

example2:

const handleVerifySubmit = ({
  otp,
}: {
  otp: string, // 'otp' PropType is defined but prop is never used eslint(react/no-unused-prop-types)
}) => {
  dispatch(
    verifyOTPPhone({
      otp,
    }),
  );
};

I get false positives when defining the type of a destructured prop. Would greatly appreciate any help!

eslint@6.8.0
eslint-plugin-react@7.19.0
typescript@3.7.2

@Winggo Winggo changed the title react/no-unused-prop-types false positive when defining types with TypeScript react/no-unused-prop-types false positive when defining type of destructured props [TS] Jun 30, 2020
@ljharb ljharb closed this as completed in 4ee6f8e Jun 30, 2020
@MaciekBaron

This comment has been minimized.

@ljharb

This comment has been minimized.

@MaciekBaron

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants