Skip to content

Commit 0828458

Browse files
committed
refactor: Add correct typing
1 parent b9b7855 commit 0828458

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { reactive } from 'vue'
1+
import { reactive, Plugin } from 'vue'
22
import { OptionsInterface } from './interfaces/options'
33
import { LanguageInterface } from './interfaces/language'
44
import { ReplacementsInterface } from './interfaces/replacements'
@@ -89,8 +89,8 @@ export function trans(key: string, replacements: ReplacementsInterface): string
8989
return message
9090
}
9191

92-
export const i18nVue: object = {
93-
install: (app, currentOptions: OptionsInterface) => {
92+
export const i18nVue: Plugin = {
93+
install: (app, currentOptions: OptionsInterface = {}) => {
9494
options = { ...options, ...currentOptions }
9595
app.config.globalProperties.$t = (key: string, replacements: ReplacementsInterface) => trans(key, replacements)
9696
loadLanguageAsync(options.lang)

src/interfaces/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { LanguageJsonFileInterface } from './language-json-file'
44
* The Interface that is responsible for the Options provided.
55
*/
66
export interface OptionsInterface {
7-
lang: string
8-
resolve(lang: string): Promise<LanguageJsonFileInterface>
7+
lang?: string
8+
resolve?(lang: string): Promise<LanguageJsonFileInterface>
99
}

0 commit comments

Comments
 (0)