-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Honogood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstatus: review neededRequest for reviewRequest for review
Description
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
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
Metadata
Metadata
Assignees
Labels
Honogood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstatus: review neededRequest for reviewRequest for review