Skip to content

Commit e9b417f

Browse files
committed
fix: make type corrections
1 parent 50ed325 commit e9b417f

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/data-structures/queue/queue-array.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
class Queue {
55
constructor () {
6+
/** @type {any[]} */
67
this._dataArray = []
78
}
89

@@ -44,8 +45,8 @@ class Queue {
4445
/**
4546
* Add data to the back of the queue.
4647
* Time complexity: O(1) from push().
47-
* @param {*} data Data to be added.
48-
* @returns {Object} This queue.
48+
* @param {any} data Data to be added.
49+
* @returns {Queue} This queue.
4950
*/
5051
enqueue (data) {
5152
this._dataArray.push(data)

src/data-structures/queue/queue.test.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@ const { describe, it } = require('node:test')
33

44
const structures = require('./queue.repo')
55

6-
const validateState = (queue, length, isEmpty, peek) => {
6+
/**
7+
* @typedef Queue
8+
* @property {number} length
9+
* @property {() => boolean} isEmpty
10+
* @property {() => any} peek
11+
* @property {(data: any) => Queue} enqueue
12+
*/
13+
14+
/**
15+
* @param {Queue} queue
16+
* @param {number} length
17+
* @param {boolean} isEmpty
18+
* @param {any} peek
19+
*/
20+
const validateState = (queue, length, isEmpty, peek = null) => {
721
assert.equal(queue.length, length)
822
assert.equal(queue.isEmpty(), isEmpty)
923

0 commit comments

Comments
 (0)