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
Describe the bug
When Trans has a parent component (either because it's set as a prop, or because the configuration has one by default), it forwards its additional props (the one it does not consume) to that object. However in Typescript, this ends up with an error like:
error TS2322: Type '{ children: string; style: CSSProperties; parent: string; }' is not assignable to type 'IntrinsicAttributes & TransProps'.
Property 'style' does not exist on type 'IntrinsicAttributes & TransProps'.
Occurs in react-i18next version
11.2.5
To Reproduce
Create a simple react-i18next Typescript strictly typed app and use a component:
<Trans parent="div" style={{color: 'green'}}>
Hello world, React is super green
</Trans>
This works as I expect it to work at runtime (it creates a div, and style the text in green). However Typescript Compiler chokes on it with:
error TS2322: Type '{ children: string; style: CSSProperties; parent: string; }' is not assignable to type 'IntrinsicAttributes & TransProps'.
Property 'style' does not exist on type 'IntrinsicAttributes & TransProps'.
Expected behaviour
I'd expect to accept the additional props happily. As a first step I would be fine if Trans was not checking those additional props, it's even better if it manages to check their types properly but I doubt it's doable especially if the parent is set in the config.
Describe the bug
When Trans has a parent component (either because it's set as a prop, or because the configuration has one by default), it forwards its additional props (the one it does not consume) to that object. However in Typescript, this ends up with an error like:
Occurs in react-i18next version
11.2.5
To Reproduce
Create a simple react-i18next Typescript strictly typed app and use a component:
This works as I expect it to work at runtime (it creates a div, and style the text in green). However Typescript Compiler chokes on it with:
Expected behaviour
I'd expect to accept the additional props happily. As a first step I would be fine if Trans was not checking those additional props, it's even better if it manages to check their types properly but I doubt it's doable especially if the parent is set in the config.
OS (please complete the following information):
The text was updated successfully, but these errors were encountered: