Skip to content

Commit

Permalink
front: remove PathItemLocation cast in useSetupItineraryForTrainUpdate()
Browse files Browse the repository at this point in the history
TypeScript is not smart enough to understand that the result of
omit() is a PathItemLocation. Use standard JavaScript destructuring
instead.

Signed-off-by: Simon Ser <[email protected]>
  • Loading branch information
emersion committed Dec 23, 2024
1 parent ac6be95 commit 6e4f7ee
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useEffect } from 'react';

import { type Position } from '@turf/helpers';
import { omit } from 'lodash';

import {
osrdEditoastApi,
type PathItemLocation,
type PostInfraByInfraIdPathPropertiesApiArg,
type PostInfraByInfraIdPathfindingBlocksApiArg,
type RollingStockWithLiveries,
Expand Down Expand Up @@ -145,9 +143,8 @@ const useSetupItineraryForTrainUpdate = (trainIdToEdit: number) => {
const params: PostInfraByInfraIdPathfindingBlocksApiArg = {
infraId,
pathfindingInput: {
path_items: trainSchedule.path.map((item) =>
omit(item, ['id', 'deleted'])
) as PathItemLocation[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
path_items: trainSchedule.path.map(({ id, deleted, ...item }) => item),
rolling_stock_is_thermal: isThermal(rollingStock.effort_curves.modes),
rolling_stock_loading_gauge: rollingStock.loading_gauge,
rolling_stock_supported_electrifications: getSupportedElectrification(
Expand Down

0 comments on commit 6e4f7ee

Please sign in to comment.