intlify / vue-i18n

Vue I18n for Vue 3
https://vue-i18n.intlify.dev/
MIT License
2.15k stars 327 forks source link

vue-i18n-bridge: vue-tsc throws TS errors #788

Closed Shinigami92 closed 2 years ago

Shinigami92 commented 2 years ago

Reporting a bug?

node_modules/vue-i18n-bridge/dist/vue-i18n-bridge.d.ts:1:15 - error TS2614: Module '"vue"' has no exported member 'App'. Did you mean to use 'import App from "vue"' instead?

1 import type { App } from 'vue';
                ~~~

node_modules/vue-i18n-bridge/dist/vue-i18n-bridge.d.ts:2:15 - error TS2614: Module '"vue"' has no exported member 'ComponentInternalInstance'. Did you mean to use 'import ComponentInternalInstance from "vue"' instead?

2 import type { ComponentInternalInstance } from 'vue';
                ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/vue-i18n-bridge/dist/vue-i18n-bridge.d.ts:3:15 - error TS2614: Module '"vue"' has no exported member 'ComputedRef'. Did you mean to use 'import ComputedRef from "vue"' instead?

3 import type { ComputedRef } from 'vue';
                ~~~~~~~~~~~

node_modules/vue-i18n-bridge/dist/vue-i18n-bridge.d.ts:7:10 - error TS2614: Module '"vue"' has no exported member 'InjectionKey'. Did you mean to use 'import InjectionKey from "vue"' instead?

7 import { InjectionKey } from 'vue';
           ~~~~~~~~~~~~

node_modules/vue-i18n-bridge/dist/vue-i18n-bridge.d.ts:45:15 - error TS2614: Module '"vue"' has no exported member 'WritableComputedRef'. Did you mean to use 'import WritableComputedRef from "vue"' instead?

45 import type { WritableComputedRef } from 'vue';
                 ~~~~~~~~~~~~~~~~~~~

Found 5 errors.

Expected behavior

No errors should be thrown

Reproduction

Set up a simple project with vue 2, vue-tsc and i18n libs

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
    Memory: 217.01 MB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 3.1.0 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 95.0.4638.69
    Firefox: 70.0.1
    Safari: 15.1
  npmPackages:
    @vue/cli-plugin-babel: ~5.0.0-rc.0 => 5.0.0-rc.0 
    @vue/cli-plugin-unit-jest: ~5.0.0-rc.0 => 5.0.0-rc.0 
    @vue/cli-service: ~5.0.0-rc.0 => 5.0.0-rc.0 
    @vue/composition-api: ~1.4.0 => 1.4.0 
    @vue/eslint-config-prettier: ~6.0.0 => 6.0.0 
    @vue/eslint-config-typescript: ~9.0.1 => 9.0.1 
    @vue/runtime-core: ~3.2.22 => 3.2.22 
    @vue/runtime-dom: ~3.2.22 => 3.2.22 
    @vue/test-utils: ~1.2.2 => 1.2.2 
    @vue/vue2-jest: ~27.0.0-alpha.3 => 27.0.0-alpha.3 
    vite: ~2.6.14 => 2.6.14 
    vite-plugin-time-reporter: ~1.0.0 => 1.0.0 
    vite-plugin-ts-nameof: ~1.1.0 => 1.1.0 
    vite-plugin-vue2: ~1.9.0 => 1.9.0 
    vue: ~2.6.14 => 2.6.14 
    vue-chartjs: ~3.5.1 => 3.5.1 
    vue-frag: ~1.3.1 => 1.3.1 
    vue-i18n: ~8.26.7 => 8.26.7 
    vue-i18n-bridge: ~9.2.0-beta.18 => 9.2.0-beta.18 
    vue-moment: ~4.1.0 => 4.1.0 
    vue-resource: ~1.5.3 => 1.5.3 
    vue-router: ~3.5.3 => 3.5.3 
    vue-shortkey: ~3.1.7 => 3.1.7 
    vue-template-compiler: ~2.6.14 => 2.6.14 
    vue-tsc: ~0.29.5 => 0.29.5 
    vuedraggable: ~2.24.3 => 2.24.3 
    vuetify: ~2.5.14 => 2.5.14

Screenshot

image

Additional context

The bridge should maybe use vue-demi or just @vue/composition-api instead of vue

Validations

kazupon commented 2 years ago

Thank you for your reporting!

I can't fully reproduce your package.js deps environment, so I tried minimal environments the below:

However, Unfortunately, I could not reproduce this issue. :disappointed: when I ran vue-tsc in my environment, the type checking error did not occur.

I checked the .d.ts generated by vue-i18n-bridge, and it imports from vue. It seems to be a cause of this issue.

The bridge should maybe use vue-demi or just @vue/composition-api instead of vue

In about this, vue-i18n-bridge assumes migration using @vue/composition-api. vue-demi unfortunately does not.

Shinigami92 commented 2 years ago

https://github.com/Shinigami92/vue-i18n-bridge-788/runs/4223735585?check_suite_focus=true#step:7:10

kazupon commented 2 years ago

Thank you for your reproduction repo! I'll try to check your repo!

Shinigami92 commented 2 years ago

Works 🎉 thx

kazupon commented 2 years ago

Happy coding! :)