vue-i18n
vue-i18n copied to clipboard
Inconsistent Vue plugin `install` function interface between ts typing and the actual code ❗
Reporting a bug?
The first concerning issue 1️⃣
The I18n
ts interface declares install
function here as
install(app: App, ...options: unknown[]): void
which is totally fine and aligned with the VueJs3 unit test here and aligned with the plugin installation contract - the install
function expected to be synchronous ❗
But, the actual implementation function here is async
// install plugin
async install(app: App, ...options: unknown[]): Promise<void> {
The second concerning issue 2️⃣
When we assume the first issue is totally fine, since no one is concerned about it so far, because VueJs is actually calling
that install
method synchronously.
When we try to call the async installation method it returns Promise which is never ending, always "pending"
import { createI18n } from 'vue-i18n'
const pluginInstance = createI18n({})
// this hangs the script execution, since Promise never will be resolved, it just waits indefinitely 🤷
const installationPromiseResult = await pluginInstance.install(app, {})
Expected behavior
If you insists that the install
method should be "async" for some reason, please do the right thing and return something / auto-resolve the returned Promise at least 😄
Reproduction
import { createI18n } from 'vue-i18n'
const pluginInstance = createI18n({})
// this hangs the script execution, since Promise never will be resolved, it just waits indefinitely 🤷
const installationPromiseResult = await pluginInstance.install(app, {})
System Info
doesn't matter
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 Discussions