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

View File

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