From 92a0efaace75174f2e0fc155ef6525fca6bb50a3 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Thu, 6 Feb 2025 23:49:28 +0400 Subject: [PATCH] Annotating tag utils with types --- src/lib/booru/tag-utils.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/booru/tag-utils.ts b/src/lib/booru/tag-utils.ts index c430c4c..3270685 100644 --- a/src/lib/booru/tag-utils.ts +++ b/src/lib/booru/tag-utils.ts @@ -1,22 +1,21 @@ /** * Build the map containing both real tags and their aliases. * - * @param {string[]} realAndAliasedTags List combining aliases and tag names. - * @param {string[]} realTags List of actual tag names, excluding aliases. + * @param realAndAliasedTags List combining aliases and tag names. + * @param realTags List of actual tag names, excluding aliases. * - * @return {Map} Map where key is a tag or alias and value is an actual tag name. + * @return Map where key is a tag or alias and value is an actual tag name. */ -export function buildTagsAndAliasesMap(realAndAliasedTags, realTags) { - /** @type {Map} */ - const tagsAndAliasesMap = new Map(); +export function buildTagsAndAliasesMap(realAndAliasedTags: string[], realTags: string[]): Map { + const tagsAndAliasesMap: Map = new Map(); - for (let tagName of realTags) { + for (const tagName of realTags) { tagsAndAliasesMap.set(tagName, tagName); } - let realTagName = null; + let realTagName: string | null = null; - for (let tagNameOrAlias of realAndAliasedTags) { + for (const tagNameOrAlias of realAndAliasedTags) { if (tagsAndAliasesMap.has(tagNameOrAlias)) { realTagName = tagNameOrAlias; continue;