You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I kept getting some errors (No overload matches this call. / Type 'ObjectPlugin<any[]>' is not assignable to type 'Plugin') when building my application with TypeScript
It seems that Vue excepts the plugin to be the type ObjectPlugin but i18nVue is type Plugin
I'm not that strong in TypeScript, so I don't have a clear idea if it's on purpose or anything, but I managed to fix it by casting the plugin as an ObjectPlugin
My fix:
.use(<ObjectPlugin>i18nVue, {resolve: async(lang: string)=>{const langs =import.meta.glob('../../lang/*.json');return<Promise<LanguageJsonFileInterface>>awaitlangs[`../../lang/${lang}.json`]()}})
Error output from the build command:
bun run build
$ vue-tsc && vite build
resources/js/app.ts:39:12 - error TS2769: No overload matches this call.
Overload 1 of 2, '(plugin: Plugin<[{ resolve: (lang: string) => Promise<unknown>; }]>, options_0: { resolve: (lang: string) => Promise<unknown>; }): App<Element>', gave the following error.
Argument of type 'Plugin' is not assignable to parameter of type 'Plugin<[{ resolve: (lang: string) => Promise<unknown>; }]>'.
Type 'ObjectPlugin<any[]>' is not assignable to type 'Plugin<[{ resolve: (lang: string) => Promise<unknown>; }]>'.
Type 'ObjectPlugin<any[]>' is not assignable to type 'FunctionPlugin<[{ resolve: (lang: string) => Promise<unknown>; }]>'.
Type 'ObjectPlugin<any[]>' is not assignable to type '(app: App<any>, options_0: { resolve: (lang: string) => Promise<unknown>; }) => any'.
Type 'ObjectPlugin<any[]>' provides no match for the signature '(app: App<any>, options_0: { resolve: (lang: string) => Promise<unknown>; }): any'.
Overload 2 of 2, '(plugin: Plugin<{ resolve: (lang: string) => Promise<unknown>; }>, options: { resolve: (lang: string) => Promise<unknown>; }): App<Element>', gave the following error.
Argument of type 'Plugin' is not assignable to parameter of type 'Plugin<{ resolve: (lang: string) => Promise<unknown>; }>'.
Type 'ObjectPlugin<any[]>' is not assignable to type 'Plugin<{ resolve: (lang: string) => Promise<unknown>; }>'.
Type 'ObjectPlugin<any[]>' is not assignable to type 'FunctionPlugin<{ resolve: (lang: string) => Promise<unknown>; }>'.
Type 'ObjectPlugin<any[]>' is not assignable to type '(app: App<any>, options: { resolve: (lang: string) => Promise<unknown>; }) => any'.
Type 'ObjectPlugin<any[]>' provides no match for the signature '(app: App<any>, options: { resolve: (lang: string) => Promise<unknown>; }): any'.
39 .use(i18nVue, {
~~~~~~~
Found 1 error in resources/js/app.ts:39
The text was updated successfully, but these errors were encountered:
Hi! 👋
I kept getting some errors (
No overload matches this call.
/Type 'ObjectPlugin<any[]>' is not assignable to type 'Plugin'
) when building my application with TypeScriptIt seems that Vue excepts the plugin to be the type
ObjectPlugin
buti18nVue
is typePlugin
I'm not that strong in TypeScript, so I don't have a clear idea if it's on purpose or anything, but I managed to fix it by casting the plugin as an
ObjectPlugin
My fix:
Error output from the build command:
The text was updated successfully, but these errors were encountered: