Skip to content

Commit

Permalink
fix: remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Oct 4, 2024
1 parent 00fab34 commit fb22a28
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/prepare/type-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ function generateInterface(obj: Record<string, unknown>, indentLevel = 1) {

const MERGED_OPTIONS_ENDPOINT = '__nuxt_i18n/merged'

export function prepareTypeGeneration(
{ options: _options, localeInfo, vueI18nConfigPaths }: I18nNuxtContext,
nuxt: Nuxt
) {
if (_options.experimental.typedOptionsAndMessages === false) return
// TODO: check if this is actually necessary
nuxt.options._i18n = { locales: localeInfo }
export function prepareTypeGeneration({ options, localeInfo, vueI18nConfigPaths }: I18nNuxtContext, nuxt: Nuxt) {
if (options.experimental.typedOptionsAndMessages === false) return

const resolver = createResolver(import.meta.url)

Expand Down Expand Up @@ -115,8 +110,8 @@ export {}`
})

// watch locale files for changes and update template
const paths = localeInfo.flatMap(x => x.files.map(f => f.path))
nuxt.hook('builder:watch', async (_, path) => {
const paths = nuxt.options._i18n.locales.flatMap(x => x.files.map(f => f.path))
if (!paths.includes(path) && !vueI18nConfigPaths.some(x => x.absolute.includes(path))) return
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down

0 comments on commit fb22a28

Please sign in to comment.