From b64c638b5181a5a7f55b196ae159843f82a1ed33 Mon Sep 17 00:00:00 2001 From: Pedro Durek Date: Wed, 10 Nov 2021 11:44:00 -0700 Subject: [PATCH] Rollback changes made on PR #1400 (#1402) --- ts4.1/index.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ts4.1/index.d.ts b/ts4.1/index.d.ts index 64577bf8..92d79239 100644 --- a/ts4.1/index.d.ts +++ b/ts4.1/index.d.ts @@ -214,6 +214,7 @@ export interface TFunction< type I18nKeyType = TFuncKey extends infer A ? A : never; export interface TransProps< + K extends TFuncKey extends infer A ? A : never, N extends Namespace = DefaultNamespace, E extends Element = HTMLDivElement > extends React.HTMLProps { @@ -222,7 +223,7 @@ export interface TransProps< count?: number; defaults?: string; i18n?: i18n; - i18nKey?: I18nKeyType | I18nKeyType[]; + i18nKey?: K | K[]; ns?: N; parent?: string | React.ComponentType | null; // used in React.createElement if not null tOptions?: {}; @@ -230,9 +231,11 @@ export interface TransProps< t?: TFunction; } -export function Trans( - props: TransProps, -): React.ReactElement; +export function Trans< + K extends TFuncKey extends infer A ? A : never, + N extends Namespace = DefaultNamespace, + E extends Element = HTMLDivElement +>(props: TransProps): React.ReactElement; export function useSSR(initialI18nStore: Resource, initialLanguage: string): void;