intlify / vue-i18n

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

Pollution of ComponentCustomProperties when not using globalInjection #1025

Open Shayan-To opened 2 years ago

Shayan-To commented 2 years ago

Reporting a bug?

I'm not using globalInjection, but the typing for this library is adding some properties to ComponentCustomProperties, and this is causing problems for me. I want to inject custom versions of these properties for my project, and this is stopping me from doing so. (I'm currently patching the vue-i18n package and removing the typings as a difficult-to-maintain workaround.)

Expected behavior

These injections should either be opt-in, or there should be a flag to turn them off.

Reproduction

I don't see how I should do this...

System Info

System:
    OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
    Memory: 2.26 GB / 11.40 GB
    Container: Yes
    Shell: 7.2.4 - /usr/bin/pwsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 3.2.0 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chromium: 102.0.5005.61
    Firefox: 100.0.2
  npmPackages:
    vue: ^3.2.36 => 3.2.36 
    vue-i18n: patch:vue-i18n@npm:9.1.9#.yarn/patches/vue-i18n-npm-9.1.9-80331a4387 => 9.1.9 
    vue-router: ^4.0.15 => 4.0.15 
    vue-tsc: ^0.36.1 => 0.36.1 
    vuex: ^4.0.2 => 4.0.2 
    vuex-persistedstate: ^4.1.0 => 4.1.0

Screenshot

No response

Additional context

I'd be glad to contribute a PR.

Validations

kazupon commented 2 years ago

Thank you for your feedback!

I think that we can improve this issue with using conditional exports and tsconfig with our own settings.