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

typescript warning about @typescript-eslint/unbound-method for useIntl #4133

Closed
Morriz opened this issue Jun 19, 2023 · 5 comments
Closed

typescript warning about @typescript-eslint/unbound-method for useIntl #4133

Morriz opened this issue Jun 19, 2023 · 5 comments

Comments

@Morriz
Copy link

Morriz commented Jun 19, 2023

Which package?

react-intl@6.2.10

Describe the bug

just using the useIntl hook produces the following warning:

Avoid referencing unbound methods which may cause unintentional scoping of `this`.
If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead.

To Reproduce

const { formatMessage } = useIntl()

Expected behavior

No warnings.

Screenshots

Screenshot 2023-06-19 at 10 45 22

Desktop (please complete the following information):

  • OS: OSX

Smartphone (please complete the following information):

Additional context

react-intl version: 6.2.10

@Morriz Morriz added the bug label Jun 19, 2023
@boazpoolman
Copy link

I've got the same issue.

@KarafiziArtur
Copy link

Got same issue

@TrejGun
Copy link

TrejGun commented Jul 23, 2023

hey guys I guess you have to see this typescript-eslint/typescript-eslint#2245

@jrnail23
Copy link

jrnail23 commented Aug 9, 2023

@longlho, would you accept a PR that resolves this? It should be a non-breaking type change where this: void is added to the parameter list of methods explicitly bound to intl.

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

5 participants