Next.js Discord

Discord Forum

Anyone have any idea what this might be caused?

Unanswered
Common Tern posted this in #help-forum
Open in Discord
Common TernOP
Type error: Argument of type 'string' is not assignable to parameter of type 'RouteImpl<string>'.

while using

const params = new URLSearchParams();
params.set('location', location);
params.set('startDate', stayDates.startDate ? stayDates.startDate.toISOString() : '');
params.set('endDate', stayDates.endDate ? stayDates.endDate.toISOString() : '');
params.set('guests', totalGuests.toString());

router.push('/listing-stay-map' + '?' + params.toString());

3 Replies

router.push('blabla' as Route)
import Route from next
you need to cast the whole string manipulation as Route