From e1fd7d7a9e06d78dac2ef4c364450e0a85b187b9 Mon Sep 17 00:00:00 2001 From: dimaslanjaka Date: Thu, 15 Feb 2024 00:43:25 +0700 Subject: [PATCH] fix(TS2322): Type 'unknown' is not assignable to type 'string'. --- lib/plugins/filter/template_locals/i18n.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plugins/filter/template_locals/i18n.ts b/lib/plugins/filter/template_locals/i18n.ts index 520fbfbcad..76feaa2c43 100644 --- a/lib/plugins/filter/template_locals/i18n.ts +++ b/lib/plugins/filter/template_locals/i18n.ts @@ -13,7 +13,9 @@ function i18nLocalsFilter(this: Hexo, locals: LocalsType): void { if (!lang) { const pattern = new Pattern(`${i18nDir}/*path`); - const data = pattern.match(locals.path); + // fix hexo-util/dist/pattern.d.ts is not object + // fix(TS2322): Type 'unknown' is not assignable to type 'string'. + const data = pattern.match(locals.path) as Record; if ( typeof data !== 'undefined'