Skip to content
GitHub

MessageKey

type alias in meocord/common Since 4.1.0

type MessageKey<C> = {
  [K in keyof C & string]: K extends `${string}.${string}`
    ? never
    : C[K] extends string
      ? K
      : IsPlural<C[K]> extends true
        ? K
        : `${K}.${MessageKey<C[K]>}`
}[keyof C & string]

Every message key of a catalog: the dotted path to each message or plural.

A key with a . in its own name is left out, as a lookup reads it as a path and never finds it; createTranslator warns about one. Nest it as a group.