Reputation: 4601
here I define the variable results
to be an array of strings:
let results: string[];
and here below, I assign a value to kick things off:
results['searchCaption'] = "";
and then, the show stops with ERROR TypeError: Cannot set property 'searchCaption' of undefined
What am I missing here? Do I need to define an interface for it first?
Upvotes: 1
Views: 7679
Reputation: 4918
What you want is this:
let results = new Array<string>();
results['searchCaption'] = '';
Upvotes: 9