0
I am an intern and I took on a project in a language that I don’t know much about, I’m having problems creating a return of events, I tried to look for similar errors on the internet, but without success. Follow the error:
[![Image showing where the error occurs][1]][1]
And the code:
return api.post<Response, apiEvent[]>('execute', data).then(() => {
const events: IEvent[] = response.map((item: apiEvent): IEvent[] => {
// ...
});
});
Another mistake that gives in events
is:
Type 'IEvent[][]' is not assignable to type 'IEvent[]'.
If any of you could try to explain to me the reason for the mistake, I would appreciate it very much.
i did as you said, but the error I showed in the image persisted. The code looks like this:
return api.post<Response, apiEvent[]>('execute', data).then(() => { const events: IEvent[] = response.map((item: apiEvent): IEvent => { // ... }); });
– Jonatan
Strange... I could then try to reproduce the even problem in the Typescript playground and paste the link into your question, please? cc: @Jonatan
– Luiz Felipe
Done, @Luizfelipe
– Jonatan