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

Fix react merged types #1606

Merged
merged 1 commit into from Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.d.ts
Expand Up @@ -39,11 +39,12 @@ declare module 'i18next' {
type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
? Record<string, unknown>
: never;
type ReactI18NextChild = React.ReactNode | ObjectOrNever;

type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
Copy link
Member Author

@pedrodurek pedrodurek Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, children will behave exactly like the actual one unless allowObjectInHTMLChildren is true.


declare module 'react' {
interface HTMLAttributes<T> {
children?: ReactI18NextChild | Iterable<ReactI18NextChild>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why and when we did that, but it doesn't make much sense, since ReactNode is already Iterable

Copy link
Member

@adrai adrai Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originally introduced with #1531 by @gshokanov to address #1506

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

children?: ReactI18NextChildren;
}
}

Expand Down