I have a component written in Svelte 5, using $props() rune.
LogActions.svelte
<script lang="ts">
//@ts-expect-error
let { onSave }: { (): void } = $props() ;
</script>
<div class="panel fullsize">
<button onclick={onSave}>Log QSO</button>
<button>Delete Last</button>
<button>Undelete</button>
<button>Edit Last</button>
</div>
<style>
.fullsize { width: 100% }
</style>
Please note: without the //@ts-expect-error directive, this file causes svelte-check error
Error: Property 'onSave' does not exist on type '$$ComponentProps'. (ts)
This component is used in its parent component, EntryPanel.svelte, this way:
<script lang="ts">
import LogActions from './LogActions.svelte'
function onSave(): void {
const content = JSON.stringify(Object.fromEntries(qso))
console.log(content)
//@ts-expect-error
window.api.saveQso( content )
}
</script>
...
<LogActions {onSave} />
The last line generates svelte-check error
c:\Users\jvavruska\dev\log73se\src\renderer\src\components\EntryPanel.svelte:41:16
Error: Object literal may only specify known properties, and 'onSave' does not exist in type '$$ComponentProps'. (ts)
<LogActions {onSave} />
</div>
Unlike the errors in the typescript part, which can be avoided by using //@ts-ignore
or //@ts-expect-error
, for this error I could not find any directive or hint how to disable the error.
The result is that svelte-check by generating nonsense errors block build of exe file for windows despite that the application works fine in dev mode.
How do I fix this?