vue-i18n
vue-i18n copied to clipboard
tc function is missing in typescript definition (in Composer interface)
trafficstars
Reporting a bug?
Typescript gives an error Property 'tc' does not exist on type Composer<...> in the code like that:
import { useI18n } from 'vue-i18n'
const i18n = useI18n()
const a = i18n.t('something') // <- this one is ok
const b = i18n.tc('otherthing', 1) // <- this one gives typescript error
It's indeed missing in vue-i18n.d.ts Composer definition (the first 500 rows). However it exists in the VueI18n interface.
I have to use it like
import { useI18n, VueI18n } from 'vue-i18n'
const i18n = useI18n() as unknown as VueI18n
to get rid of this error, which is not nice.
Expected behavior
tc function should just work without any typescript error
Reproduction

System Info
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Memory: 19.47 GB / 31.32 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.5 - ~/.yarn/bin/yarn
npm: 8.5.5 - ~/.nvm/versions/node/v16.14.2/bin/npm
Browsers:
Chrome: 105.0.5195.125
Firefox: 105.0
npmPackages:
@intlify/vue-i18n-loader: ^5.0.0 => 5.0.0
@vue/cli-plugin-babel: ~5.0.0 => 5.0.8
@vue/cli-plugin-eslint: ~5.0.0 => 5.0.8
@vue/cli-plugin-typescript: ~5.0.0 => 5.0.8
@vue/cli-plugin-unit-jest: ^5.0.8 => 5.0.8
@vue/cli-service: ~5.0.0 => 5.0.8
@vue/eslint-config-typescript: ^9.1.0 => 9.1.0
vue: ^3.2.13 => 3.2.40
vue-cli-plugin-vuetify: ~2.5.8 => 2.5.8
vue-i18n: ^9.2.2 => 9.2.2
vue-router: ^4.1.5 => 4.1.5
vuetify: ^3.0.0-beta.0 => 3.0.0-beta.13
vuex: ^4.0.2 => 4.0.2
Screenshot
No response
Additional context
No response
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 Discussion
- [X] The provided reproduction is a minimal reproducible example of the bug.