type error cant work out how typeerror occurs on typeahead