mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-30 18:46:00 +00:00
Resolve the remaining client type errors and the trip.title navbar bug
Drive the client typecheck to zero without any/ts-ignore: convert the tripId route param to a number once at the page boundary so it matches the numeric props and store actions it feeds, fix trip.name -> trip.title (the wire field is title, so the old read rendered blank in the files/offline views), and tighten the scattered handler-arity, DOM-cast and untyped-payload sites. No runtime behaviour change.
This commit is contained in:
@@ -26,7 +26,7 @@ export const budgetHandlers = [
|
||||
|
||||
http.put('/api/trips/:id/budget/:itemId/members', async ({ params, request }) => {
|
||||
const body = await request.json() as { user_ids: number[] };
|
||||
const members = body.user_ids.map(uid => ({ user_id: uid, paid: false }));
|
||||
const members = body.user_ids.map(uid => ({ user_id: uid, paid: 0, username: `user${uid}` }));
|
||||
const item = buildBudgetItem({ id: Number(params.itemId), trip_id: Number(params.id), persons: body.user_ids.length, members });
|
||||
return HttpResponse.json({ members, item });
|
||||
}),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import { render, type RenderOptions } from '@testing-library/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { MemoryRouter, type MemoryRouterProps } from 'react-router-dom';
|
||||
import { TranslationProvider } from '../../src/i18n/TranslationContext';
|
||||
|
||||
interface RenderWithProvidersOptions extends Omit<RenderOptions, 'wrapper'> {
|
||||
initialEntries?: string[];
|
||||
initialEntries?: MemoryRouterProps['initialEntries'];
|
||||
}
|
||||
|
||||
function renderWithProviders(
|
||||
|
||||
@@ -439,9 +439,10 @@ describe('useDayNotes', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Type augment for window.__addToast
|
||||
// Type augment for window.__addToast — must mirror the canonical declaration
|
||||
// in components/shared/Toast.tsx (a divergent signature is a merge conflict).
|
||||
declare global {
|
||||
interface Window {
|
||||
__addToast?: (message: string, type: string, duration?: number) => void;
|
||||
__addToast?: (message: string, type?: 'success' | 'error' | 'warning' | 'info', duration?: number) => number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,15 @@ function buildMockStore(assignments: Record<string, ReturnType<typeof buildAssig
|
||||
|
||||
const MOCK_SEGMENTS: RouteSegment[] = [
|
||||
{
|
||||
mid: [48.5, 2.5],
|
||||
from: [48.86, 2.35],
|
||||
to: [48.21, 16.37],
|
||||
distance: 343000,
|
||||
duration: 12600,
|
||||
distanceText: '343 km',
|
||||
durationText: '3 h 30 min',
|
||||
walkingText: '70 h',
|
||||
drivingText: '3 h 30 min',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user