Open mberrg opened 1 year ago
I'm using vue-i18n 9.2.2, and the typing of 18n.global.locale is string, but is should be ComputedRef\<string>?
My setup:
const i18n = createI18n<[GlobalMessageSchema], SupportedLangs>({ legacy: false, locale: defaultLang, fallbackLocale: 'en', messages, }); console.log(i18n.global.locale);
Typing reported in VS-code of i18n.global.locale: ts (property) VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>>.locale: string
i18n.global.locale
ts (property) VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>>.locale: string
However the variable is clearly a computed ref (from console log):
ComputedRefImpl {dep: undefined, __v_isRef: true, __v_isReadonly: false, _dirty: true, _setter: ƒ, …}
Typing of i18n.global.locale (and posisble others) should be a computed ref e.g.
(property) VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>>.locale: ComputedRef<string>
See intro text
System: OS: Windows 10 10.0.22621 CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H Memory: 17.68 GB / 31.70 GB Binaries: Node: 18.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.22621.1413.0), Chromium (111.0.1661.41) Internet Explorer: 11.0.22621.1 npmPackages: @vitejs/plugin-vue: ^4.1.0 => 4.1.0 vite: ^4.2.0 => 4.2.0 vite-plugin-eslint: ^1.8.1 => 1.8.1 vite-tsconfig-paths: ^4.0.7 => 4.0.7 vue: ^3.0.0 => 3.2.47 vue-gtag: ^2.0.1 => 2.0.1 vue-i18n: ^9.2.2 => 9.2.2 vue-router: ^4.0.0 => 4.1.6
No response
Cannot set locale via i18n.global.locale.value = locale, Typescript prompts me that locale is a String, Bad !! @mberrg
i18n.global.locale.value = locale
Reporting a bug?
I'm using vue-i18n 9.2.2, and the typing of 18n.global.locale is string, but is should be ComputedRef\<string>?
My setup:
Typing reported in VS-code of
i18n.global.locale
:ts (property) VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>>.locale: string
However the variable is clearly a computed ref (from console log):
ComputedRefImpl {dep: undefined, __v_isRef: true, __v_isReadonly: false, _dirty: true, _setter: ƒ, …}
Expected behavior
Typing of i18n.global.locale (and posisble others) should be a computed ref e.g.
(property) VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>>.locale: ComputedRef<string>
Reproduction
See intro text
System Info
Screenshot
No response
Additional context
No response
Validations