import type { Dictionary } from '../localization/locales'; /** A localization dictionary key */ type Token = keyof Dictionary; /** A dynamic argument that can be used in a localized string */ type DynamicArg = string | number; /** A record of dynamic arguments for a specific key in the localization dictionary */ type ArgsRecord = Record, DynamicArg>; /** The dynamic arguments in a localized string */ type DynamicArgs = // eslint-disable-next-line @typescript-eslint/no-unused-vars LocalizedString extends `${infer _Pre}{${infer Var}}${infer Rest}` ? Var | DynamicArgs : never; /** The arguments for retrieving a localized message */ export type GetMessageArgs = DynamicArgs extends never ? [T] : [T, ArgsRecord]; /** The props for the localization component */ export type I18nProps = DynamicArgs extends never ? { token: T } : { token: T; args: ArgsRecord }; /** The dictionary of localized strings */ export type LocalizerDictionary = Dictionary; /** A localization dictionary key */ export type LocalizerToken = keyof LocalizerDictionary;