Matt Knight
10/19/2021, 9:23 PMexistingListing: Listings & {
ListingPhotos: ListingPhotos[];
}
How do I instantiate (if that is the right word?) it on the client?
Normally I would do something like this:
existingListing: Listings = []
But with the nested model, it doesn't work.Austin
10/19/2021, 9:47 PMMatt Knight
10/19/2021, 9:52 PMAustin
10/19/2021, 9:59 PMMatt Knight
10/19/2021, 11:53 PMexistingListing: Listings & {
ListingPhotos: ListingPhotos[];
} = [];
Type 'undefined[]' is not assignable to type 'Listings & { ListingPhotos: ListingPhotos[]; }'.
Type 'undefined[]' is missing the following properties from type 'Listings': ListingId, accountId, DateTimeListed, DateAvailable, and 31 more.ts(2322)
Well, that makes sense, because I need the ListingPhotos Object.
This is accepted by the typings:
existingListing: Listings & {
ListingPhotos: ListingPhotos[];
} = [][''];
But it isn't quite right...
Anyway.. maybe it doesn't matter... casting to any
works well enough.. just not ideal.