I'm newbie at typescript and my codes:
type searchParamsProps = {
manufacturer: string,
model: string,
year: number,
fuel: string,
limit: number,
}
export default async function Home({ searchParams }: searchParamsProps) {
const allCars = await fetchCars({
manufacturer: searchParams.manufacturer || "",
model: searchParams.model || "",
year: searchParams.year || 2022,
fuel: searchParams.fuel || "",
limit: searchParams.limit || 10,
});
What is typeof of searchParams
? I tried to describe the types with with string
, number
, or union
, but how to type it correctly?
VSCode Intellisense says:
Property 'searchParams' does not exist on type 'searchParamsProps'.ts(2339)
(parameter) searchParams: any