Skip to content

Commit

Permalink
fix: type errors (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon authored Oct 20, 2022
1 parent afb33b1 commit ba86c4b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"lint": "eslint --ext .js,.ts,.vue,.json .",
"lint:fix": "pnpm lint --fix",
"test": "run-s test:unit test:spec",
"test:types": "tsc --noEmit",
"test:unit": "vitest run test",
"test:spec": "pnpm build && vitest run specs"
},
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default defineNuxtPlugin(async nuxt => {
}
setLocale(i18n, i18n.__pendingLocale)
if (i18n.__resolvePendingLocalePromise) {
await i18n.__resolvePendingLocalePromise('')
await i18n.__resolvePendingLocalePromise()
}
i18n.__pendingLocale = undefined
}
Expand Down
12 changes: 6 additions & 6 deletions src/runtime/vue-i18n-bridge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare module 'vue-i18n' {

export interface I18n {
__pendingLocale?: string
__pendingLocalePromise?: Promise
__resolvePendingLocalePromise?: (value: unknown) => void
__pendingLocalePromise?: Promise<void>
__resolvePendingLocalePromise?: (value: void | PromiseLike<void>) => void
}
}

Expand All @@ -62,8 +62,8 @@ declare module 'vue-i18n-bridge' {

export interface I18n {
__pendingLocale?: string
__pendingLocalePromise?: Promise
__resolvePendingLocalePromise?: (value: unknown) => void
__pendingLocalePromise?: Promise<void>
__resolvePendingLocalePromise?: (value: void | PromiseLike<void>) => void
}
}
declare module '@intlify/vue-i18n-bridge' {
Expand All @@ -85,8 +85,8 @@ declare module '@intlify/vue-i18n-bridge' {
}
export interface I18n {
__pendingLocale?: string
__pendingLocalePromise?: Promise
__resolvePendingLocalePromise?: (value: unknown) => void
__pendingLocalePromise?: Promise<void>
__resolvePendingLocalePromise?: (value: void | PromiseLike<void>) => void
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/gen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { generateLoaderOptions } from '../src/gen'
import { DEFAULT_OPTIONS } from '../src/constants'

import type { NuxtI18nOptions, NuxtI18nInternalOptions } from '../src/types'
import type { AdditionalMessages } from '../src/messages'

const LOCALE_CODES = ['en', 'ja', 'fr']
const LOCALE_INFO = [
Expand All @@ -25,7 +26,7 @@ const ADDITIONAL_MESSAGES = {
{ buz: 'buz', hello: 'hello3' },
{ baz: 'baz', hello: 'hello4' }
]
}
} as AdditionalMessages
const NUXT_I18N_OPTIONS = {
defaultLocale: 'en',
vueI18n: {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": ["**/.nuxt/**", "**/*/dist/*"]
"exclude": ["**/.nuxt/**", "**/*/dist/*", "docs/**", "playground/**", "specs/**"]
}

0 comments on commit ba86c4b

Please sign in to comment.