fix: TypeScript type fixes for strict mode
Add direct_hotel_id to Hotel and RateMatrixResponse interfaces, remove as-any casts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3f83084223
commit
ebbffa3137
1 changed files with 4 additions and 2 deletions
|
|
@ -41,6 +41,7 @@ interface Hotel {
|
|||
notes: string | null
|
||||
first_seen_at: string | null
|
||||
last_seen_at: string | null
|
||||
direct_hotel_id?: number | null
|
||||
}
|
||||
|
||||
interface RateMatrixResponse {
|
||||
|
|
@ -55,6 +56,7 @@ interface RateMatrixResponse {
|
|||
star_rating: number | null
|
||||
review_score: number | null
|
||||
booking_com_url: string | null
|
||||
direct_hotel_id?: number | null
|
||||
}[]
|
||||
rates: Record<number, Record<string, {
|
||||
availability_status: string
|
||||
|
|
@ -1007,11 +1009,11 @@ const RateMatrixTab: React.FC = () => {
|
|||
const { data: directRatesMap } = useQuery<Record<number, Record<string, number | null>>>({
|
||||
queryKey: ['market-direct-rates', fromDate, toDate],
|
||||
queryFn: async () => {
|
||||
const compHotels = hotels.filter(h => h.tier === 'competitor' && (h as any).direct_hotel_id)
|
||||
const compHotels = hotels.filter(h => h.tier === 'competitor' && h.direct_hotel_id)
|
||||
if (!compHotels.length) return {}
|
||||
const result: Record<number, Record<string, number | null>> = {}
|
||||
await Promise.all(compHotels.map(async h => {
|
||||
const directId = (h as any).direct_hotel_id
|
||||
const directId = h.direct_hotel_id!
|
||||
try {
|
||||
const res = await api.get(`/direct/hotels/${directId}/dates`, {
|
||||
params: { from_date: fromDate, to_date: toDate }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue