You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
riolly
changed the title
Can't pass multiple argument to formatter
Argument with custom type is not passed to the formatter
Nov 4, 2023
riolly
changed the title
Argument with custom type is not passed to the formatter
Argument with custom type is not passed to the formatter function
Nov 4, 2023
Even though this was passing typescript, the call to LL was passing the argument as a "keyed argument". Passing the index through in an object works around the issue, but fails typescript: LL.money({ 0: { value, currency: valueCurrency }})
As a workaround, specifying an argument key in the translation passes typescript and works as expected at runtime:
// i18n/en/index.tsconsten={money: "{money:MonetaryAmount|currency}",}// component.tsfunctionMoney({value, valueCurrency}: {value: number,valueCurrency: string}){const{LL}=useI18nContext()// now compiles in typescript and works as expected at runtimereturn<Text>{LL.money({money: { value,currency: valueCurrency}})}</Text>}
So this is only an issue if you use a single indexed argument in the translation.
Version
5.26.2
Describe the bug
Following this instruction failed to pass an argument of custom type to the formatter function.
Reproduction
Logs
Value correctly typed but the value undefined
Config
Additional information
No response
The text was updated successfully, but these errors were encountered: