you can simply do:
const router = useRouter();
router.push(
{
pathname: '/cars',
query: {
colors,
type,
price,
},
undefined,
{
shallow: true,
},
);
According to Next/Router type, query is typeof ParsedUrlQuery
which equivalent to
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { }
That is to say, next/router is able to parse both string and array of strings
CLICK HERE to find out more related problems solutions.