import type nb from "./locales/nb"; /* https://dev.to/pffigueiredo/typescript-utility-keyof-nested-object-2pa3 */ type NestedKeyOf = { [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? `${Key}.${NestedKeyOf}` : `${Key}`; }[keyof ObjectType & (string | number)]; export type TFunction = ( keypath: NestedKeyOf, replacements?: Record, ) => string; /* https://stackoverflow.com/questions/47914536/use-partial-in-nested-property-with-typescripts */ type RecursivePartial = { [P in keyof T]?: RecursivePartial; }; export type Translations = typeof nb; export type PartialTranslations = RecursivePartial; export type Component = keyof Translations; export type ComponentTranslation = RecursivePartial< Translations[T] >;