1 2 3 4 5 6 7 8 9 10 11 12 13
import type { VercelRequest } from '@vercel/node'; export function getFirstQueryParam(key: string, query: VercelRequest['query']): string | null { const value = query[key]; if (!value) { return null; } if (typeof(value) === 'string') { return value; } return value[0] as string; }