vue-i18n
vue-i18n copied to clipboard
Typing regression on "useI18n()": spyOn return "never" type
trafficstars
Reporting a bug?
After upgrade from 9.3.0-beta.27, the mock of useI18n() doesn't work:
import * as vueI18n from 'vue-i18n'
vi.spyOn(vueI18n, 'useI18n').mockReturnValue({})
throws
Property 'mockReturnValue' does not exist on type 'never'.
Expected behavior
No error :)
Reproduction
- Create TypeScript project
npm install vue-i118n- Add a simple test
import { vi } from 'vitest' import * as vueI18n from 'vue-i18n' vi.spyOn(vueI18n, 'useI18n').mockReturnValue({}) npm run type-check
System Info
System:
OS: Windows 10 10.0.22621
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
Memory: 10.91 GB / 31.69 GB
Binaries:
Node: 20.0.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.5.0 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Spartan (44.22621.2134.0), Chromium (117.0.2045.36)
Internet Explorer: 11.0.22621.1
Screenshot
No response
Additional context
Seems be a gression in https://github.com/intlify/vue-i18n-next/commit/7ebb0e4f69658ea76237bc24ff3e9e8b722063ec#diff-90783ef144f3a897c890355ff61bd08a99bbd36764128426b6f899a72e766f2eR731
Updating line to previous version NonNullable<Options['locale']> works!
Validations
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussions