From b92d7aba0412b1b3a3025c3707415796c0aca5d8 Mon Sep 17 00:00:00 2001 From: Bill Collins Date: Wed, 11 Dec 2024 10:05:44 +0000 Subject: [PATCH] Global JSX namespace is deprecated --- index.d.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/index.d.ts b/index.d.ts index fffb6fbd2..5b8b778ca 100644 --- a/index.d.ts +++ b/index.d.ts @@ -42,14 +42,6 @@ declare module 'i18next' { } } -declare global { - namespace JSX { - interface IntrinsicAttributes { - i18nIsDynamicList?: boolean; - } - } -} - type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true ? Record : never; @@ -57,6 +49,12 @@ type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true type ReactI18NextChildren = React.ReactNode | ObjectOrNever; declare module 'react' { + namespace JSX { + interface IntrinsicAttributes { + i18nIsDynamicList?: boolean; + } + } + interface HTMLAttributes { // This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop // expects a single child of type 'ReactI18NextChildren', but multiple children were provided": @@ -144,7 +142,7 @@ export function withTranslation< }, ): < C extends React.ComponentType & WithTranslationProps>, - ResolvedProps = JSX.LibraryManagedAttributes< + ResolvedProps = React.JSX.LibraryManagedAttributes< C, $Subtract, WithTranslationProps> >,