https://github.com/WebDevSimplified/intl-crash-course/blob/51d1f91b71c17d698a03978fd963c15ff0f6c964/src/i18n/lib/init.ts#L83C3-L83C39
Hey WebDevSimplified,
I was implementing your stuff on my project and faced this issue.
TS2344: Type
NormalizedTranslationAtKey<TranslationAtKeyWithParams<LanguageMessages, S>>[0]
does not satisfy the constraint string
Type
NormalizedTranslationAtKey<S extends string | number ? LanguageMessages | I18nMessage : never>[0]
is not assignable to type string
Type string | LanguageMessages is not assignable to type string
Type LanguageMessages is not assignable to type strin
luckily, I solved it with adding extra code at end ofNormalizedTranslationAtKeyWithParams enforcing to accept possible types but hopefully is has a better solution.
type NormalizedTranslationAtKeyWithParams<Key extends string> = NormalizedTranslationAtKey<
TranslationAtKeyWithParams<RegisteredTranslations, Key> &
(string | ReturnType<typeof defineTranslation>)
>
Thanks for you great solution,
br,
https://github.com/WebDevSimplified/intl-crash-course/blob/51d1f91b71c17d698a03978fd963c15ff0f6c964/src/i18n/lib/init.ts#L83C3-L83C39
Hey WebDevSimplified,
I was implementing your stuff on my project and faced this issue.
luckily, I solved it with adding extra code at end ofNormalizedTranslationAtKeyWithParams enforcing to accept possible types but hopefully is has a better solution.
Thanks for you great solution,
br,