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
since a { name } object is not a valid React child. react-i18next offers a new allowObjectInHTMLChildren option to adjust TypeScript's type definitions to allow this; however, it's a fairly drastic option and causes all React children everywhere to allow arbitrary objects (even if they're not part of <Trans>).
An alternative is to use an as any cast (or similar) at the call site:
🚀 Feature Proposal
i18next-parser cannot currently handle TypeScript
as
casts within a JSX file. For example:gets extracted as
"Hello, <1>{{ name } as any}</1>!"
instead of"Hello, <1>{{name}}</1>!"
.Motivation
As discussed in i18next/react-i18next#1483, React 18's type definitions cause TypeScript to start throwing errors for code such as
since a
{ name }
object is not a valid React child. react-i18next offers a newallowObjectInHTMLChildren
option to adjust TypeScript's type definitions to allow this; however, it's a fairly drastic option and causes all React children everywhere to allow arbitrary objects (even if they're not part of<Trans>
).An alternative is to use an
as any
cast (or similar) at the call site:However, i18next-parser doesn't currently parse this properly.
Example
See above.
The text was updated successfully, but these errors were encountered: