zrwusa / data-structure-typed

Javascript Data Structure & TypeScript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree, AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack.
https://data-structure-typed-docs.vercel.app
MIT License
118 stars 8 forks source link

The type check of BinaryTree's 'has' function incorrect #27

Closed zrwusa closed 10 months ago

zrwusa commented 10 months ago

Describe the bug expect(tree.has(tree.get(4), node => node.key)).toBe(false); The type check needs to bring an error

To Reproduce tree.add(1); tree.add(2); tree.add(3);

expect(tree.has(1)).toBe(true);
expect(tree.has(2)).toBe(true);
expect(tree.has(3)).toBe(true);
expect(tree.has(4)).toBe(false);
expect(tree.has(tree.get(4), node => node.key)).toBe(false);

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

zrwusa commented 10 months ago

In v1.39.3, we have fixed this