/**
 *  Class represeting a stack
 */ class Stack < T > { list : Array < T > ; constructor constructor ( ) { this . list = [ ] ; } name function param { T } item push ( item ) { this . list . push ( item ) ; } name function returns { T } pop ( ) { return this . list . pop ( ) ; } name function returns { T } peek ( ) { if ( ! this . list . length ) { throw new Error ( "No items in stack" ) ; } return this . list [ this . list . length - 1 ] ; } name function param { T } item remove ( item ) { this . list = this . list . filter ( x => x !== item ) ; } name function returns { Number } get length ( ) : number { return this . list . length ; } } export default Stack ;