konvajs / svelte-konva

A Svelte wrapper for Konva
https://konvajs.org/docs/svelte/
MIT License
58 stars 4 forks source link

Typescript errors ts(1485) and ts(1361) on Stage and Layer with v1.0.0-next #202

Open drWindstrom opened 1 week ago

drWindstrom commented 1 week ago

Hi,

I am trying the v1.0.0-next release of svelte-konva with svelte 5. Everything is working fine, but I get two typescript errors with the code below.

For Stage and Layer in the import statement I get: 'Stage' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.ts(1485)

For Stage and Layer on the html elements I get: 'Stage' cannot be used as a value because it was imported using 'import type'.ts(1361)

<script lang="ts">
    import { Stage, Layer, Rect } from 'svelte-konva';

    let myX = $state(100);
    let myY = $state(100);

</script>

<Stage width={window.innerWidth} height={window.innerHeight}>
    <Layer>
        <Rect x={myX} y={myY} width={400} height={200} fill="blue" draggable />
    </Layer>
</Stage>

Regards drWindstrom

TeyKey1 commented 5 days ago

Hi @drWindstrom

Thanks for the report. I can reproduce this and will have a detailed look at this once I find time. With svelte-konva v1, the generated declaration file structure has somewhat changed compared to v0, which is still on my todo list to investigate.