Following is my TypeScript code, which is showing error in Visual Studio Code, let me know what I am missing here -
Code -
class Queue {
data = [];
push(item: number) {
return this.data.push(item); <- red error showing on item here
}
pop() {
return this.data.shift();
}
}
const myQueue = new Queue();
console.log(myQueue.push(5)); // Ouptut - 1
console.log(myQueue.push(7)); // Output - 2
Error -
Argument of type 'number' is not assignable to parameter of type 'never'