Skip to content

type error: vue-i18n 9.14.0 breaks $t function in Vue 3.4.38 #1923

@isamu

Description

@isamu

Reporting a bug?

When updating vue-i18n from version 9.13.1 to 9.14.0, the $t function, which is used for translation, no longer works correctly in a Vue 3.4.38 project. The following error is displayed

ERROR(vue-tsc)  Property '$t' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{ msg: { type: StringConstructor; default: string; }; }>>, unknown, unknown, {}, {}, ComponentOptionsMixin, ... 13 more ..., { ...; }>'.

Expected behavior

The $t function should work as expected, allowing for translations without any TypeScript errors or runtime issues, just as it does in vue-i18n version 9.13.1.

Reproduction

  • Install vue-i18n version 9.14.0 in a Vue 3.4.38 project.
  • Attempt to use the $t function in a component to access translations.
  • Observe the error mentioned above during compilation or runtime.

System Info

System:
    OS: macOS 14.5
    CPU: (20) arm64 Apple M1 Ultra
    Memory: 24.53 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nodebrew/node/v18.18.2/bin/node
    Yarn: 1.22.21 - ~/.nodebrew/node/v18.18.2/bin/yarn
    npm: 10.7.0 - ~/.nodebrew/node/v18.18.2/bin/npm
    pnpm: 8.12.1 - ~/.nodebrew/node/v18.18.2/bin/pnpm
  Browsers:
    Chrome: 127.0.6533.120
    Edge: 127.0.2651.105
    Safari: 17.5
  npmPackages:
    @vitejs/plugin-vue: ^5.1.2 => 5.1.2 
    @vue/eslint-config-typescript: ^13.0.0 => 13.0.0 
    vite: ^5.4.2 => 5.4.2 
    vite-plugin-checker: ^0.7.2 => 0.7.2 
    vue: ^3.4.38 => 3.4.38 
    vue-eslint-parser: ^9.4.3 => 9.4.3 
    vue-i18n: ^9.14.0 => 9.14.0 
    vue-router: ^4.4.3 => 4.4.3 
    vue-tsc: ^2.0.29 => 2.0.29

Screenshot

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions