Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
BeeMargarida committed Sep 12, 2023
1 parent 2931a45 commit 8f8420a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,13 @@ type FlattenObject<TObject, TPrefix extends string = ''> = {
}[keyof TObject];

// Retrieves a type for a given key path (calculated from the type above)
type TranslateType<TObject, TPath extends string> = TPath extends keyof TObject ? TObject[TPath] : TPath extends `${infer TKey}.${infer TRest}` ? (TKey extends keyof TObject ? TranslateType<TObject[TKey], TRest> : never) : never;
type TranslateType<TObject, TPath extends string> = TPath extends keyof TObject
? TObject[TPath]
: TPath extends `${infer TKey}.${infer TRest}`
? TKey extends keyof TObject
? TranslateType<TObject[TKey], TRest>
: never
: never;

type TranslationsType = typeof en;

Expand Down

0 comments on commit 8f8420a

Please sign in to comment.