mirror of
https://github.com/mousebomb/obsidian-diary-ics.git
synced 2026-07-22 05:49:47 +00:00
Avoid using any. Use more type-safe alternatives or unknown.
This commit is contained in:
parent
d128277729
commit
231e247746
1 changed files with 4 additions and 3 deletions
|
|
@ -166,9 +166,10 @@ const zh: LanguageStrings = {
|
|||
};
|
||||
|
||||
// 格式化字符串,替换{0}, {1}等占位符
|
||||
function formatString(str: string, ...args: any[]): string {
|
||||
return str.replace(/{(\d+)}/g, (match, index) => {
|
||||
return typeof args[index] !== 'undefined' ? args[index] : match;
|
||||
function formatString(str: string, ...args: unknown[]): string {
|
||||
return str.replace(/{(\d+)}/g, (match, indexStr) => {
|
||||
const index = parseInt(indexStr, 10);
|
||||
return typeof args[index] !== 'undefined' ? String(args[index]) : match;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue