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

Type broke in 23.12.1 #2214

Closed
hieuminh1810 opened this issue Jul 15, 2024 · 4 comments
Closed

Type broke in 23.12.1 #2214

hieuminh1810 opened this issue Jul 15, 2024 · 4 comments

Comments

@hieuminh1810
Copy link

💥 Regression Report

I have seen keys that are not in the JSON file

Screenshot 2024-07-15 at 3 31 36 PM

Last working version

Worked up to version: "i18next": "22.4.6", "react-i18next": "12.1.1"

Stopped working in version: "i18next": "^23.12.1", "react-i18next": "^14.1.2"

To Reproduce

update to the latest version ("i18next": "^23.12.1", "react-i18next": "^14.1.2")

export const RESOURCES_LANGUAGES = {
  en: {
    translation: en,
  },
} as const;
import 'i18next';
import { RESOURCES_LANGUAGES } from '@locale/index';

declare module 'i18next' {
  interface CustomTypeOptions {
    resources: typeof RESOURCES_LANGUAGES.en;
  }
}

Expected behavior

The keys shown are all in my JSON file

Your Environment

  • runtime version: "react": "18.2.0", "node": ">=18", "typescript": "^5.5.3"
  • i18next version: "^23.12.1" , "react-i18next": "^14.1.2",
  • os: Mac
@adrai
Copy link
Member

adrai commented Jul 15, 2024

This seems to work: https://github.com/i18next/i18next/tree/master/examples/typescript

Please provide a minimal reproducible example repository...

@hieuminh1810
Copy link
Author

hieuminh1810 commented Jul 15, 2024

This seems to work: https://github.com/i18next/i18next/tree/master/examples/typescript

Please provide a minimal reproducible example repository...

Screenshot 2024-07-15 at 5 48 16 PM

@adrai
Copy link
Member

adrai commented Jul 15, 2024

Your screenshot shows, that it works as expected.... "thank_you" is listed

"thankou" is also listed, because you are using the "_" and that is used as pluralSeparator and contextSeparator character...

https://www.i18next.com/overview/typescript
image

If you don't need that, just change that to a different separator:
image

@hieuminh1810
Copy link
Author

@adrai tks you so much
it work well ^__^

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

2 participants