🚨 Fix compilation for types

This commit is contained in:
ajnart
2022-05-23 10:44:31 +02:00
parent 64dbb9c025
commit 10d9ffc740
2 changed files with 3 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ export function DndList({ data }: DndListProps) {
return ( return (
<DragDropContext <DragDropContext
onDragEnd={({ destination, source }) => onDragEnd={({ destination, source }) =>
handlers.reorder({ from: source.index, to: destination.index }) handlers.reorder({ from: source.index, to: (destination && destination.index) ?? -1 })
} }
> >
<Droppable droppableId="dnd-list" direction="vertical"> <Droppable droppableId="dnd-list" direction="vertical">

View File

@@ -13,7 +13,6 @@ import { Grid } from '@mantine/core';
import { SortableItem } from '../components/dnd/StorableItem'; import { SortableItem } from '../components/dnd/StorableItem';
import { AppShelfItem } from '../components/AppShelf/AppShelf'; import { AppShelfItem } from '../components/AppShelf/AppShelf';
import { useConfig } from '../tools/state'; import { useConfig } from '../tools/state';
import { Config } from '../tools/types';
export default function App() { export default function App() {
const [activeId, setActiveId] = useState(null); const [activeId, setActiveId] = useState(null);
@@ -49,13 +48,13 @@ export default function App() {
</DndContext> </DndContext>
); );
function handleDragStart(event) { function handleDragStart(event: any) {
const { active } = event; const { active } = event;
setActiveId(active.id); setActiveId(active.id);
} }
function handleDragEnd(event) { function handleDragEnd(event: any) {
const { active, over } = event; const { active, over } = event;
if (active.id !== over.id) { if (active.id !== over.id) {