Skip to content

Commit a24220d

Browse files
Merge pull request #18 from caryyu/master
Resolve @types/p-queue-ts missing
2 parents 42d3872 + 70e576b commit a24220d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

index.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
declare module 'p-queue-ts' {
2+
type Comparator<T> = (a: T, b: T) => boolean;
3+
4+
export class PriorityQueue<T> {
5+
constructor(comparator?: Comparator<T>);
6+
7+
/**
8+
* Inserts the specified element into this priority queue.
9+
*/
10+
push: (value: T) => void;
11+
/**
12+
* Returns true if this queue contains the specified element.
13+
*/
14+
contains: (value: T, comparator?: (item: T) => boolean) => boolean;
15+
/**
16+
* Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
17+
*/
18+
top: () => T;
19+
/**
20+
* Retrieves and removes the head of this queue, or returns null if this queue is empty.
21+
* Everytime pop element from queue, the queue is started "sift down" to rebuild the heap
22+
*/
23+
pop: () => T;
24+
/**
25+
* Returns the number of elements in this collection.
26+
*/
27+
size: () => number;
28+
/**
29+
* Checks whether the queue is empty.
30+
*/
31+
empty: () => boolean;
32+
/**
33+
* Removes all of the elements from this priority queue.
34+
*/
35+
clear: () => void;
36+
/**
37+
* Returns an array containing all of the elements in this queue.
38+
*/
39+
toArray: () => T[];
40+
}
41+
}
42+

0 commit comments

Comments
 (0)