-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
CustomTypeOptions pollute and break all other instances #1976
Comments
Ahh you mean other i18next instances... Yes, typed translations only work for 1 i18next instance now. I don't know if it could be ever possible to have typesafe translations for multiple i18next instances in the same project... 🤷♂️ |
Yes. This is same as global variable pollution. CustomTypeOptions must be parameterized and capsuled but actually defined as a global type affecting all instances. |
@henrikvolmer may I ask your opinion regarding this? |
Can you please provide a full example in codesandbox.io. |
@henrikvolmer he means, something like this does not work... https://github.com/adrai/ts-i18next-multi-instances/blob/main/index.ts |
Never work with appropriate designs. Handling a local state via/as a global state is a very bad approach/design. That is an obvious anti-pattern and many problems actually arise easily. That has to be rescinded for the time being. Remember that overly complex types usually prevent basic use. Advanced type safety is not worth sacrificing basic type safety. Advanced safety devoid of basic safety is fake. |
A correct and complete fix is difficult or impossible, and it would take a long time. Can you remove the wrong type definitions for the time being? Otherwise, it would remain severely broken for a long time. In addition, performance is very likely to deteriorate. If it does not work in actual development, it is worthless. Make it fast. |
@pedrodurek do you know what @falsandtru means? |
fyi: based on the feedback we are receiving for v23 it seems much better than old versions 🤷♂️ |
Users in TS would be few or not using CustomTypeOptions. Well, at least the issues of performance problems are reported: #1972, #1956, #1921, #1883. Fixing it correctly is not enough. Correct deep types will make it even worse. It will cause even more users to not be able to use your types and product 🤷♂️ |
Note that the actual issues, including duplicates, are much higher. Of course, potential numbers are not countable. |
May I ask you to help us to fix the problem instead of just complaining about how bad the update (in your eyes) is? If the new version is actually not working for you, just downgrade it to the older version in your project. Just asking for a complete revert of a major version is not helping at all. |
It's a futile work. You don't understand that too bad to fix all! Understand how it is bad before doing something. |
Maintainer's answer:
Given the above, CustomTypeOptions will be a trap for a large growing product on TypeScript as many performance problems are reported. |
I'll still chime in my two cents tho. First of all, performance issues are still at large. I'm thinking moving towards integrating more things into the bespoke build-system, in order to ease typescript type checking, among other things it already does to translations. But that's not exactly As in global type pollution, well it is definitely a thing. Although I doubt there are extensive uses of Untype
|
|
Described at #1971 (comment)
The text was updated successfully, but these errors were encountered: