I am building a app using react, typescript and msw. When I am adding types I got this error:
Type 'Recommendation[]' does not satisfy the constraint 'PathParams'. Index signature for type 'string' is missing in type 'Recommendation[]'.ts(2344)
my get handler:
rest.get<DefaultRequestBody, Recommendation[]>( '/recommendations', (req, res, ctx) => { return res(ctx.status(200), ctx.json({ recommendations })); } ),
Recommendation interface
export interface Recommendation { id: string; name: string; rating: number; description: string; image: string; url: string; }
Recommendation mock data example
export const recommendations = [ { id: 'asd12324342casd1', name: 'Gran torino', rating: 8.2, description: 'Walt Kowalski to emerytowany weteran żyjący we własnym poukładanym świecie. Jego spokój zostaje zburzony przez nowych sąsiadów z Azji, których syn spróbuje ukraść mu ulubione auto.', url: 'https://www.filmweb.pl/film/Gran+Torino-2008-476580', image: 'https://fwcdn.pl/fpo/65/80/476580/7239651.3.jpg', }, ]