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

t.rich return type has become wrong when using it in Next v15 projects together with the new React v19 types #1440

Closed
3 tasks done
ChristianIvicevic opened this issue Oct 22, 2024 · 2 comments · Fixed by #1445
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@ChristianIvicevic
Copy link

ChristianIvicevic commented Oct 22, 2024

Description

After attempting to migrate to Next v15 I noticed a false positive during linting causing linting to fail and I narrowed it down to t.rich behaving differently in terms of types. Without looking into the implementation details it feels like that t.rich relies on some React specific types that were changed in v19.

Verifications

  • I've verified that the problem I'm experiencing isn't covered in the docs.
  • I've searched for similar, existing issues on GitHub and Stack Overflow.
  • I've compared my app to a working example to look for differences.

Mandatory reproduction URL

https://github.com/ChristianIvicevic/next-intl-bug-repro-app-router/tree/next-15

Reproduction description

Steps to reproduce:

  1. Open reproduction which is in the next-15 branch (that is the result of applying the codemod from Next v15 onto the main branch of the reproduction, refer to the commit)
  2. Open app/[locale]/page.tsx in your editor
  3. See error: t.rich returns any
CleanShot 2024-10-22 at 18 45 58@2x

Expected behaviour

In the main branch of the same reproduction you will notice how t.rich is correctly typed and returns string | ReactElement | ReactNodeArray as expected. It being any in the reproduction causes eslint to complain with the no-unsafe-return error.

CleanShot 2024-10-22 at 18 46 57@2x CleanShot 2024-10-22 at 18 48 19@2x
@amannn
Copy link
Owner

amannn commented Oct 22, 2024

Thanks for the careful reproduction! 🙏

I've opened #1445 to address this.

As a side note, if you consider upgrading to Next.js 15 already, you might want to consider #1442.

@ChristianIvicevic
Copy link
Author

Thanks for looking into it!
Regarding your warning, I don't use i18n routing anyways, so one less thing to keep track of when migrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants