Skip to content

Commit

Permalink
fix: Remove usage of deprecated ReactNodeArray which is removed in …
Browse files Browse the repository at this point in the history
…React 19 (#1445)

Fixes #1440
  • Loading branch information
amannn authored Oct 22, 2024
1 parent e79dd7e commit 2396345
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/next-intl/src/react-server/getTranslator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ReactElement, ReactNodeArray, cache} from 'react';
import {ReactNode, cache} from 'react';
import {
Formats,
MarkupTranslationValues,
Expand Down Expand Up @@ -59,7 +59,7 @@ function getTranslatorImpl<
key: TargetKey,
values?: RichTranslationValues,
formats?: Formats
): string | ReactElement | ReactNodeArray;
): ReactNode;

// `markup`
markup<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ReactElement, ReactNodeArray, cache} from 'react';
import {ReactNode, cache} from 'react';
import {
Formats,
MarkupTranslationValues,
Expand Down Expand Up @@ -64,7 +64,7 @@ Promise<{
key: [TargetKey] extends [never] ? string : TargetKey,
values?: RichTranslationValues,
formats?: Formats
): string | ReactElement | ReactNodeArray;
): ReactNode;

// `markup`
markup<
Expand Down Expand Up @@ -171,7 +171,7 @@ Promise<{
key: TargetKey,
values?: RichTranslationValues,
formats?: Formats
): string | ReactElement | ReactNodeArray;
): ReactNode;

// `markup`
markup<
Expand Down
10 changes: 2 additions & 8 deletions packages/use-intl/src/core/createBaseTranslator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import IntlMessageFormat from 'intl-messageformat';
import {
ReactElement,
ReactNode,
ReactNodeArray,
cloneElement,
isValidElement
} from 'react';
import {ReactNode, cloneElement, isValidElement} from 'react';
import AbstractIntlMessages from './AbstractIntlMessages';
import Formats from './Formats';
import {InitializedIntlConfig} from './IntlConfig';
Expand Down Expand Up @@ -225,7 +219,7 @@ function createBaseTranslatorImpl<
values?: RichTranslationValues,
/** Provide custom formats for numbers, dates and times. */
formats?: Formats
): string | ReactElement | ReactNodeArray {
): ReactNode {
if (hasMessagesError) {
// We have already warned about this during render
return getMessageFallback({
Expand Down
4 changes: 2 additions & 2 deletions packages/use-intl/src/core/createTranslator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ReactElement, ReactNodeArray} from 'react';
import {ReactNode} from 'react';
import Formats from './Formats';
import IntlConfig from './IntlConfig';
import TranslationValues, {
Expand Down Expand Up @@ -86,7 +86,7 @@ export default function createTranslator<
key: TargetKey,
values?: RichTranslationValues,
formats?: Formats
): string | ReactElement | ReactNodeArray;
): ReactNode;

// `markup`
markup<
Expand Down
4 changes: 2 additions & 2 deletions packages/use-intl/src/react/useTranslations.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ReactElement, ReactNodeArray} from 'react';
import {ReactNode} from 'react';
import Formats from '../core/Formats';
import TranslationValues, {
MarkupTranslationValues,
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function useTranslations<
key: TargetKey,
values?: RichTranslationValues,
formats?: Formats
): string | ReactElement | ReactNodeArray;
): ReactNode;

// `markup`
markup<
Expand Down

0 comments on commit 2396345

Please sign in to comment.