vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

Typing regression on "useI18n()": spyOn return "never" type

Open pinguet62 opened this issue 2 years ago • 3 comments
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

  1. Create TypeScript project
  2. npm install vue-i118n
  3. Add a simple test
    import { vi } from 'vitest'
    import * as vueI18n from 'vue-i18n'
    vi.spyOn(vueI18n, 'useI18n').mockReturnValue({})
    
  4. 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

pinguet62 avatar Sep 21 '23 09:09 pinguet62