-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$t
does not have TypeScript auto-completions
#1215
Comments
Any news about |
In the meantime you can use the non-global method and you'll have all the intellisense you need, just like in the script <template>
<div>{{ t("foo") }}</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
</script> |
Any updates? |
I was looking for this feature, is there any update on this? I am open to contributing! |
When declaring types for $t<...>(
key: Key | ResourceKeys | Path
): TranslateResult The definition of this type /** @VueI18nGeneral */
export type Path = string This is breaking type inference for translations when using |
close via #1883 1883 |
Reporting a bug?
The
$t
global function in SFCs' templates don't seem to support global TypeScript definitions.The documentation regarding this topic doesn't mention
$t
but its definition look like it should support auto-completion.Expected behavior
$t
should provide auto-completion through the overridenDefineLocaleMessage
interface, liket
exported fromuseI18n
does.Reproduction
Create a
i18n.json
file with the following content:Details
Create a
i18n.ts
file with the following content:Create a Vue 3 application, import
./i18n.ts
and register the exported plugin.System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: