forked from FoundKeyGang/FoundKey
Provide intermediate type to calm typechecker down in i18n
This commit is contained in:
parent
4568fba7a9
commit
f17eb379ac
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ export class I18n<T extends Record<string, any>> {
|
||||||
// なるべくこのメソッド使うよりもlocale直接参照の方がvueのキャッシュ効いてパフォーマンスが良いかも
|
// なるべくこのメソッド使うよりもlocale直接参照の方がvueのキャッシュ効いてパフォーマンスが良いかも
|
||||||
public t(key: string, args?: Record<string, any>): string {
|
public t(key: string, args?: Record<string, any>): string {
|
||||||
try {
|
try {
|
||||||
let str = key.split('.').reduce((o, i) => o[i], this.locale) as string;
|
let str = key.split('.').reduce((o, i) => o[i] as Record<string, any> | string, this.locale) as string;
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
for (const [k, v] of Object.entries(args)) {
|
for (const [k, v] of Object.entries(args)) {
|
||||||
|
|
Loading…
Reference in a new issue