Skip to content

types: re-add @types/hoist-non-react-statics to dependencies #2316

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

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

marcalexiei
Copy link
Contributor

Fixes #2315

Reverts #2310


From #2310:

type declaration files are typically used during development and compilation but are not required at runtime.

This is generally true, however next-i18next actually relies on types from hoist-non-react-statics which are exposed to the user:

import hoistNonReactStatics from 'hoist-non-react-statics'

return hoistNonReactStatics(AppWithTranslation, WrappedComponent)

If types are not included when installing the library, users will experience types errors,
that might be hidden if skipLibCheck typescript compiler option is set to true (like in #2315).


If you don't want that @types package is always installed you should use peerDependencies alongside peerDependenciesMeta.
However, this will require user to manually install @types package,
so a mention to this should be added in all relevant places.

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

@adrai
Copy link
Member

adrai commented Feb 6, 2025

@Erik-Gro fyi

@adrai adrai merged commit 84c9655 into i18next:master Feb 6, 2025
5 checks passed
@adrai
Copy link
Member

adrai commented Feb 6, 2025

thank you, it's included in v15.4.2

@Erik-Gro
Copy link
Contributor

Erik-Gro commented Feb 7, 2025

@adrai @marcalexiei thanks for the information

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

Successfully merging this pull request may close these issues.

new appWithTranslation's return type not backwards compatible
3 participants