@@ -16,7 +16,7 @@ const TupleSet = require("../util/TupleSet");
1616class TupleQueue {
1717 /**
1818 * Seeds the queue with an optional iterable of tuples to visit.
19- * @param {Iterable<[T, V]>= } items The initial elements.
19+ * @param {Iterable<[T, V, ...EXPECTED_ANY ]>= } items The initial elements.
2020 */
2121 constructor ( items ) {
2222 /**
@@ -26,7 +26,7 @@ class TupleQueue {
2626 this . _set = new TupleSet ( items ) ;
2727 /**
2828 * @private
29- * @type {Iterator<[T, V]> }
29+ * @type {Iterator<[T, V, ...EXPECTED_ANY ]> }
3030 */
3131 this . _iterator = this . _set [ Symbol . iterator ] ( ) ;
3232 }
@@ -41,7 +41,7 @@ class TupleQueue {
4141
4242 /**
4343 * Enqueues a tuple if it is not already present in the underlying set.
44- * @param {[T, V] } item The element to add.
44+ * @param {[T, V, ...EXPECTED_ANY ] } item The element to add.
4545 * @returns {void }
4646 */
4747 enqueue ( ...item ) {
@@ -51,22 +51,22 @@ class TupleQueue {
5151 /**
5252 * Removes and returns the next queued tuple, rebuilding the iterator when
5353 * the underlying tuple set has changed since the last full pass.
54- * @returns {[T, V] | undefined } The head of the queue of `undefined` if this queue is empty.
54+ * @returns {[T, V, ...EXPECTED_ANY ] | undefined } The head of the queue of `undefined` if this queue is empty.
5555 */
5656 dequeue ( ) {
5757 const result = this . _iterator . next ( ) ;
5858 if ( result . done ) {
5959 if ( this . _set . size > 0 ) {
6060 this . _iterator = this . _set [ Symbol . iterator ] ( ) ;
6161 const value =
62- /** @type {[T, V] } */
62+ /** @type {[T, V, ...EXPECTED_ANY ] } */
6363 ( this . _iterator . next ( ) . value ) ;
6464 this . _set . delete ( ...value ) ;
6565 return value ;
6666 }
6767 return ;
6868 }
69- this . _set . delete ( .../** @type {[T, V] } */ ( result . value ) ) ;
69+ this . _set . delete ( .../** @type {[T, V, ...EXPECTED_ANY ] } */ ( result . value ) ) ;
7070 return result . value ;
7171 }
7272}
0 commit comments