diff --git a/codes/typescript/chapter_searching/hashing_search.ts b/codes/typescript/chapter_searching/hashing_search.ts index ef0245a9..6133942b 100644 --- a/codes/typescript/chapter_searching/hashing_search.ts +++ b/codes/typescript/chapter_searching/hashing_search.ts @@ -16,10 +16,10 @@ function hashingSearch(map: Map, target: number) { } /* 哈希查找(链表) */ -function hashingSearch1(map: Map, target: number) { +function hashingSearch1(map: Map, target: number): ListNode | null { // 哈希表的 key: 目标结点值,value: 结点对象 // 若哈希表中无此 key ,返回 null - return map.has(target) ? map.get(target) : null; + return map.has(target) ? map.get(target) as ListNode : null; } function main() {