Skip to content

Why does the "t" function returned by the useI18n method not have type hints for global resources? #2183

Open
@Autumn-one

Description

@Autumn-one

Clear and concise description of the problem

In the setup component of Vue 3, I use the useI18n method to return the t method. I found that this method only provides type hints for local resources, but it doesn't provide type hints for resources set globally. For example, in the following code:

const {t} = use_local({
    messages: {
        zh: {
            title: '<UNK>',
        },
        en: {
            title: "EN"
        }
    }
});

Here, when calling t, it only suggests "title", but in fact, there are some fields in the global resources that are not suggested. Is this a feature that has not yet been implemented?

Suggested solution

It is expected to merge the types of local resources and global resources for type hints.

Alternative

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