Describe the bug
Consider the following factory
import {
defineI18nMiddleware,
detectLocaleFromAcceptLanguageHeader
} from '@intlify/hono';
export function createI18nMiddleware<TSchema extends Record<string, string>>(
schema: TSchema,
translations: Record<string, TSchema> = {},
) {
return defineI18nMiddleware<{ message: TSchema }>({
locale: detectLocaleFromAcceptLanguageHeader,
messages: { ...translations, en: schema },
// ^^ <-- TS error
});
}
The TS error
Type 'TSchema' is not assignable to type 'TSchema extends LocaleMessage<string> ? TSchema : LocaleMessage<string>'.
Type 'Record<string, string>' is not assignable to type 'TSchema extends LocaleMessage<string> ? TSchema : LocaleMessage<string>'
Not sure if it's me doing something wrong here.
Reproduction
System Info
Used Package Manager
other (if you use other package manager, please describe at the Additional context)
Additional context
bun v1.0.12
Validations
Describe the bug
Consider the following factory
The TS error
Not sure if it's me doing something wrong here.
Reproduction
System Info
Used Package Manager
other (if you use other package manager, please describe at the
Additional context)Additional context
bun v1.0.12
Validations