remove typescript warnings

This commit is contained in:
Stephan Egli 2025-01-20 14:27:52 +01:00
parent 7f4594e9eb
commit c0a07eb6cd
2 changed files with 5 additions and 10 deletions

View File

@ -32,7 +32,7 @@
}
});
handle.on("change", ({ doc }) => {
handle.on("change", ({ doc }: { doc: AppDocument | undefined }) => {
if (doc) {
console.log("Document changed:", doc.shapes); // Debug log
// it looks like Svelte is clever enough to make only the necessary DOM changes
@ -85,12 +85,12 @@
{#if shape.type === "circle"}
<Circle
{...shape}
handleDragStart={(e, shape) => handleDragStart(e, shape)}
handleDragStart={(e: MouseEvent, shape: Shape) => handleDragStart(e, shape)}
/>
{:else if shape.type === "triangle"}
<Triangle
{...shape}
handleDragStart={(e, shape) => handleDragStart(e, shape)}
handleDragStart={(e: MouseEvent, shape: Shape) => handleDragStart(e, shape)}
/>
{/if}
{/each}

View File

@ -1,15 +1,10 @@
<script lang="ts">
const { id, coordinates, color, handleDragStart } = $props<{
id: string;
coordinates: [number, number, number, number, number, number];
color: string;
handleDragStart: (e: MouseEvent, shape: any) => void;
}>();
const { id, coordinates, color, handleDragStart } = $props();
let points = $state('');
$effect(() => {
points = coordinates
.map(p => `${p.x},${p.y}`)
.map((p: { x: any; y: any; }) => `${p.x},${p.y}`)
.join(" ");
});