File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
packages/vue-i18n-core/src Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1081,6 +1081,30 @@ export interface ComposerNumberFormatting<
10811081 ) : string
10821082}
10831083
1084+ /**
1085+ * The type custom definition of Composer
1086+ *
1087+ * @remarks
1088+ *
1089+ * The interface that can extend Composer.
1090+ *
1091+ * The type defined by 3rd party (e.g. nuxt/i18n)
1092+ *
1093+ * @example
1094+ * ```ts
1095+ * // vue-i18n.d.ts (`.d.ts` file at your app)
1096+ *
1097+ * declare module 'vue-i18n' {
1098+ * interface ComposerCustom {
1099+ * localeCodes: string[]
1100+ * }
1101+ * }
1102+ * ```
1103+ *
1104+ * @VueI 18nComposition
1105+ */
1106+ export interface ComposerCustom { } // eslint-disable-line @typescript-eslint/no-empty-interface
1107+
10841108/**
10851109 * Composer interfaces
10861110 *
@@ -1103,7 +1127,7 @@ export interface Composer<
11031127 ? Locale
11041128 : ResourceLocales
11051129 : OptionLocale | ResourceLocales
1106- > {
1130+ > extends ComposerCustom {
11071131 /**
11081132 * @remarks
11091133 * Instance ID.
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ import {
1414import { SchemaParams , LocaleParams } from '../../packages/core-base/src'
1515import { ResourceSchema , MyDatetimeScehma , MyNumberSchema } from '../schema'
1616
17+ declare module '../../packages/vue-i18n-core/src/composer' {
18+ interface ComposerCustom {
19+ localeCode : string [ ]
20+ }
21+ }
22+
1723// loose options
1824const looseOptions = {
1925 locale : 'en' ,
@@ -133,6 +139,7 @@ expectType<typeof looseComposer.messages.value.en>(
133139expectType < { japan : string } > (
134140 looseComposer . getLocaleMessage < { japan : string } > ( 'japan' )
135141)
142+ expectType < string [ ] > ( looseComposer . localeCode )
136143looseComposer . setLocaleMessage ( 'en' , {
137144 foo : 'foo' ,
138145 nest : {
You can’t perform that action at this time.
0 commit comments