fix: Strictly implemented the IBinaryTree interface in TreeMultiMap and AVLTreeMultiMap, while passing the correct MV[] type.

This commit is contained in:
Revone 2024-11-30 13:27:07 +13:00
parent b16559bc54
commit cbda9c152b
2 changed files with 10 additions and 16 deletions

View file

@ -7,6 +7,7 @@
*/
import { AVLTreeMultiMapOptions, BTNOptKeyOrNull, BTNRep, OptNodeOrNull } from '../../types';
import { AVLTree, AVLTreeNode } from './avl-tree';
import { IBinaryTree } from '../../interfaces';
export class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K, V[]> {
/**
@ -54,14 +55,10 @@ export class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K, V[]> {
/**
*
*/
export class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends AVLTree<
K,
V[],
R,
MK,
MV,
MR
> {
export class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object>
extends AVLTree<K, V[], R, MK, MV[], MR>
implements IBinaryTree<K, V[], R, MK, MV[], MR>
{
/**
* The constructor initializes an AVLTreeMultiMap with the provided keys, nodes, entries, or raw data
* and options.

View file

@ -7,6 +7,7 @@
*/
import type { BTNOptKeyOrNull, BTNRep, OptNodeOrNull, TreeMultiMapOptions } from '../../types';
import { RedBlackTree, RedBlackTreeNode } from './red-black-tree';
import { IBinaryTree } from '../../interfaces';
export class TreeMultiMapNode<K = any, V = any> extends RedBlackTreeNode<K, V[]> {
/**
@ -60,14 +61,10 @@ export class TreeMultiMapNode<K = any, V = any> extends RedBlackTreeNode<K, V[]>
* console.log(tmm.search(new Range(4, 12))); // [5, 10, 12, 7]
* console.log(tmm.search(new Range(15, 20))); // [15, 18]
*/
export class TreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends RedBlackTree<
K,
V[],
R,
MK,
MV,
MR
> {
export class TreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object>
extends RedBlackTree<K, V[], R, MK, MV[], MR>
implements IBinaryTree<K, V[], R, MK, MV[], MR>
{
/**
* The constructor initializes an TreeMultiMap with the provided keys, nodes, entries, or raw data
* and options.