feat(frontend): add intersection between available translation types

This commit is contained in:
yassinedorbozgithub 2024-10-02 05:24:52 +01:00
parent 8b0b388c0d
commit 43e0f53a3b

View File

@ -12,10 +12,12 @@ import { translations } from ".";
import { TFilterNestedKeysOfType } from "@/types/common/object.types";
export type TTranslation =
| (typeof translations)["en"]
| (typeof translations)["fr"];
export type TTranslationKeys = TFilterNestedKeysOfType<TTranslation>;
type TEnTranslation = (typeof translations)["en"];
type TFrTranslation = (typeof translations)["fr"];
export type TTranslation = TEnTranslation & TFrTranslation;
export type TTranslationKeys = TFilterNestedKeysOfType<TEnTranslation> &
TFilterNestedKeysOfType<TFrTranslation>;
export type TNestedTranslation<T extends keyof TTranslation> =
TFilterNestedKeysOfType<TTranslation[T]>;