Skip to content

TypeScript supportΒ #123

Open
Open
@7nohe

Description

@7nohe

I am interested in having type-safe resources support like Vue I18n. Is it possible to achieve this?

import { createI18n } from 'vue-i18n'
import enUS from './locales/en-US.json'

// Type-define 'en-US' as the master schema for the resource
type MessageSchema = typeof enUS

const i18n = createI18n<[MessageSchema], 'en-US' | 'ja-JP'>({
  locale: 'en-US',
  messages: {
    'en-US': enUS
  }
})

https://vue-i18n.intlify.dev/guide/advanced/typescript.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions