From 69ec4e078ea6640781bf2b2670d85ed862fcba06 Mon Sep 17 00:00:00 2001 From: Piotr Idzik Date: Thu, 6 Jun 2024 15:17:59 +0000 Subject: [PATCH 1/3] style: resolve `consistent-indexed-object-style` --- data_structures/tries/tries.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/tries/tries.ts b/data_structures/tries/tries.ts index 78dc1432..ee7ce774 100644 --- a/data_structures/tries/tries.ts +++ b/data_structures/tries/tries.ts @@ -5,7 +5,7 @@ class TrieNode { /** * An object that stores child nodes for each character in the alphabet. */ - children: { [key: string]: TrieNode } = {} + children: Record = {} /** * Indicates whether the node represents the end of a word. From e641e71ab0a42ceb34a575dcf566d6f6c693862d Mon Sep 17 00:00:00 2001 From: Piotr Idzik Date: Thu, 6 Jun 2024 15:21:17 +0000 Subject: [PATCH 2/3] style: remove redundant constructor --- data_structures/tries/tries.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/data_structures/tries/tries.ts b/data_structures/tries/tries.ts index ee7ce774..4d1997f1 100644 --- a/data_structures/tries/tries.ts +++ b/data_structures/tries/tries.ts @@ -22,11 +22,6 @@ export class Trie { */ root: TrieNode = new TrieNode() - /** - * Creates a new Trie instance. - */ - constructor() {} - /** * Inserts a word into the Trie. * From 896d430ff0801ebc8aba9c3db19cc0339874137e Mon Sep 17 00:00:00 2001 From: Piotr Idzik Date: Thu, 6 Jun 2024 15:24:49 +0000 Subject: [PATCH 3/3] style: resolve `non-inferrable-types` --- data_structures/tries/tries.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data_structures/tries/tries.ts b/data_structures/tries/tries.ts index 4d1997f1..2ec99c94 100644 --- a/data_structures/tries/tries.ts +++ b/data_structures/tries/tries.ts @@ -10,7 +10,7 @@ class TrieNode { /** * Indicates whether the node represents the end of a word. */ - isWord: boolean = false + isWord = false } /** @@ -46,7 +46,7 @@ export class Trie { * If false, the method returns true only if an exact match is found. * @returns True if the word (or prefix) is found in the Trie; otherwise, false. */ - public find(word: string, isPrefixMatch: boolean = false): boolean { + public find(word: string, isPrefixMatch = false): boolean { return this.searchNode(this.root, word, isPrefixMatch) }