Tech
TypeScript Infers the Last Overload... So I Changed the Order
Once I was working with i18next and wanted to get better inference from translation keys.
Usually, with translation libraries, we pass keys as strings:
translate ( " user.profile.title " );
And strings are fine... until they are not.
I wanted something closer in spirit to C# expression trees. Not real expression trees, of course — JavaScript does not have those. But something like this:
translate ( $ => $ . user . profile . title );
...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to