Utilizing an addItem
function that I found on this site, I encountered the following error message:
Error TS2349 (TS) Cannot invoke an expression whose type lacks a call signature. Type 'Search' has no compatible call signatures.
Definition of Interface:
export interface Search {
name: String;
type: String;
inputValue: String;
}
Declarations:
array : Search[];
searches: Search[];
Snippet from TypeScript:
addItems(startIndex, endIndex, _method) {
let movieIndex = 0
for (let i = 0; i < this.sum; ++i) {
movieIndex++;
if (movieIndex >= this.searches.length) movieIndex = 0;
this.array[_method](this.s
earches[movieIndex]);
}
}
Invocation:
this.addItems(startIndex, endIndex, 'push');
Fetching Data Source (from node server):
fetchSearches() {
this.searchService.getSearches()
.subscribe((data: Search[]) => {
this.searches = data
this.searches.forEach(search => {
search.inputValue = search.name;
})
console.log('Data requested...')
});
}