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

Remove generics from Trans component to suppress warning issue #1400

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions ts4.1/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ export interface TFunction<
): TFuncReturn<N, TKeys, TDefaultResult>;
}

type I18nKeyType<N extends Namespace> = TFuncKey<N> extends infer A ? A : never;
export interface TransProps<
K extends TFuncKey<N> extends infer A ? A : never,
N extends Namespace = DefaultNamespace,
E extends Element = HTMLDivElement
> extends React.HTMLProps<E> {
Expand All @@ -213,18 +213,17 @@ export interface TransProps<
count?: number;
defaults?: string;
i18n?: i18n;
i18nKey?: K | K[];
i18nKey?: I18nKeyType<N> | I18nKeyType<N>[];
ns?: N;
parent?: string | React.ComponentType<any> | null; // used in React.createElement if not null
tOptions?: {};
values?: {};
t?: TFunction<N>;
}
export function Trans<
K extends TFuncKey<N> extends infer A ? A : never,
N extends Namespace = DefaultNamespace,
E extends Element = HTMLDivElement
>(props: TransProps<K, N, E>): React.ReactElement;

export function Trans<N extends Namespace = DefaultNamespace, E extends Element = HTMLDivElement>(
props: TransProps<N, E>,
): React.ReactElement;

export function useSSR(initialI18nStore: Resource, initialLanguage: string): void;

Expand Down