Skip to content

Commit

Permalink
add length check for better static typing
Browse files Browse the repository at this point in the history
  • Loading branch information
choden-dev committed Aug 19, 2024
1 parent 00a74d3 commit 00f1beb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/src/app/bookings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const BookingPage = async () => {
* We assume there will be only one based on the way {@link LodgeInformation}
* is set up in sanity
*/
const lodgeInfoSingleton: LodgeInformation | undefined = lodgeInfo[0]
const lodgeInfoSingleton: LodgeInformation | undefined =
// However this can only be a singleton if the list is non-empty
lodgeInfo.length > 0 ? lodgeInfo[0] : undefined

const RenderedContent = () => {
return (
Expand Down

0 comments on commit 00f1beb

Please sign in to comment.