import { Listing, Reservation, User } from "@prisma/client"
export type safeListings = Omit<Listing, 'createdAt'> & {
createdAt?: string;
}
export type safeReservation = Omit<
Reservation,
'createdAt' | 'startDate' | 'endDate' | 'listing'
> & {
createdAt?: string,
startDate?: string,
endDate?: string,
listing?: safeListings
}
export type safeUser = Omit<
User,
"createdAt" | "updatedAt" | "emailVerified"
> & {
createdAt?: string;
updatedAt?: string;
emailVerified?: Date | null;
};
errors are as follows:
Type ‘({ listing: { id: string; title: string; description: string; imageSrc: string; createAt: Date; category: string; roomCount: number; bathroomCount: number; guestCount: number; locationValue: string; userId: string; price: number; }; } & { …; })[]’ is not assignable to type ‘safeReservation[]’.
Type ‘{ listing: { id: string; title: string; description: string; imageSrc: string; createAt: Date; category: string; roomCount: number; bathroomCount: number; guestCount: number; locationValue: string; userId: string; price: number; }; } & { …; }’ is not assignable to type ‘safeReservation’.
Type ‘{ listing: { id: string; title: string; description: string; imageSrc: string; createAt: Date; category: string; roomCount: number; bathroomCount: number; guestCount: number; locationValue: string; userId: string; price: number; }; } & { …; }’ is not assignable to type ‘{ createdAt?: string | undefined; startDate?: string | undefined; endDate?: string | undefined; listing?: safeListings | undefined; }’.
Types of property ‘createdAt’ are incompatible.
Type ‘Date’ is not assignable to type ‘string’.
Note: Working fine in Localhost, giving build time errors
My Git-Hub repo for more clear understanding : Github Link
Atul Patidar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.