namespace LinkedList { class NumberListNode { value : number ; next : NumberListNode | undefined ; constructor ( value ) { this . value = value ; this . next = undefined ; } } class NumberLinkedList { private tail : NumberListNode = { value : 0 , next : undefined } ; private head : NumberListNode = this . tail ; at ( index ) { let result = this . head . next ; while ( index > 0 && result != undefined ) { result = result . next ; index -- ; } if ( result == undefined ) throw new Error ( ) ; return result . value ; } append ( value ) { this . tail . next = { value : value , next : undefined } ; this . tail = this . tail . next ; } } }