Skip to content

Commit

Permalink
(BSR): remove unchecked index
Browse files Browse the repository at this point in the history
  • Loading branch information
nmajorfrances-pass committed Oct 30, 2024
1 parent aa32bc4 commit 402a1ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions scripts/noUncheckedIndexedAccess_snapshot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
./src/features/bookOffer/helpers/useRotatingText.ts:57
./src/features/bookOffer/pages/BookingOfferModal.tsx:134
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:251
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:389
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:417
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:448
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:492
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:520
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:551
./src/features/bookings/pages/BookingDetails/BookingDetails.tsx:97
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:391
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:419
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:450
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:494
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:522
./src/features/bookings/pages/BookingDetails/BookingDetails.native.test.tsx:553
./src/features/culturalSurvey/helpers/useGetNextQuestion.ts:13
./src/features/culturalSurvey/pages/CulturalSurveyQuestions.native.test.tsx:240
./src/features/deeplinks/helpers/getScreenFromDeeplink.ts:13
Expand Down
8 changes: 4 additions & 4 deletions src/features/bookings/pages/BookingDetails/BookingDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react'
import { Platform, ScrollView, useWindowDimensions, View } from 'react-native'
import styled from 'styled-components/native'

import { BookingReponse } from 'api/gen'
import { useBookings, useOngoingOrEndedBooking } from 'features/bookings/api'
import { ArchiveBookingModal } from 'features/bookings/components/ArchiveBookingModal'
import { BookingDetailsCancelButton } from 'features/bookings/components/BookingDetailsCancelButton'
Expand Down Expand Up @@ -89,13 +90,12 @@ export function BookingDetails() {
// Allows to display a message in case of refresh specifying the cancellation
// of the reservation being consulted if it is made via Flask Admin
// and booking is not archived
const cancellationConsultedBooking = endedBookings.filter(
const cancellationConsultedBooking: BookingReponse[] = endedBookings.filter(
(item) => item.id === params.id && !isEligibleBookingsForArchive(item)
)

if (cancellationConsultedBooking.length > 0) {
// @ts-expect-error: because of noUncheckedIndexedAccess
const nameCanceledBooking = cancellationConsultedBooking[0].stock.offer.name
if (cancellationConsultedBooking.length > 0 && cancellationConsultedBooking[0]) {
const nameCanceledBooking: string = cancellationConsultedBooking[0].stock.offer.name
showInfoSnackBar({
message: `Ta réservation "${nameCanceledBooking}" a été annulée`,
timeout: SNACK_BAR_TIME_OUT,
Expand Down

0 comments on commit 402a1ea

Please sign in to comment.