Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript declaration does not include new allowObjectInHTMLChildren option #1506

Closed
cravend opened this issue May 25, 2022 · 7 comments · Fixed by #1531
Closed

Typescript declaration does not include new allowObjectInHTMLChildren option #1506

cravend opened this issue May 25, 2022 · 7 comments · Fixed by #1531
Assignees

Comments

@cravend
Copy link

cravend commented May 25, 2022

🐛 Bug Report

Following PR #1492 and issue #1483, a new option (allowObjectInHTMLChildren) was added to fix the <Trans /> component. However, this seems to have been left out of the index.d.ts file, and is still raising errors inside the Trans component.

To Reproduce

https://github.com/cravend/react-i18next-debug

Expected behavior

The option works as expected.

Your Environment

  • runtime version: Typescript 4.6.3
  • i18next version: 21.8.3, react-i18next 11.16.9
  • os: Mac
@adrai
Copy link
Member

adrai commented May 25, 2022

@pedrodurek should we wait for #1501 ?

@pedrodurek
Copy link
Member

Hey @cravend, sorry for the delayed response, actually you should set allowObjectInHTMLChildren type declarations file: https://codesandbox.io/s/react-i18next-typed-keys-bug-forked-x77zq?file=/react-i18next.d.ts

@Igosuki
Copy link

Igosuki commented Jun 4, 2022

Setting allowObjectInHTMLChildren to true fixes the Trans component interpolation compilation but breaks children collocation, for example :

<span>
          {t('congrats', { ns: 'common' })}{' '}
          <span>Hi</span>
</span>

Breaks with TS2746: This JSX tag's 'children' prop expects a single child of type 'ReactNode | Record ', but multiple children were provided.

@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 12, 2022
@pedrodurek pedrodurek removed the stale label Jun 16, 2022
@gabriel-dehan
Copy link

Having the same issue as @Igosuki with the new option

@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 10, 2022
@Igosuki
Copy link

Igosuki commented Jul 10, 2022

Not really stale...

@stale stale bot removed the stale label Jul 10, 2022
@adrai adrai mentioned this issue Feb 2, 2023
7 tasks
adrai added a commit that referenced this issue Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants