Describe the bug
Given a .svelte file that exports snippets:
<script lang="ts" module>
import Children1Col from "$lib/tests/Children1Col.svelte";
import ChildrenEmptyCell from "$lib/tests/ChildrenEmptyCell.svelte";
export { children1Col, childrenEmptyCell };
</script>
{#snippet children1Col()}
<Children1Col />
{/snippet}
{#snippet childrenEmptyCell()}
<ChildrenEmptyCell />
{/snippet}
And later importing one of them:
import { children1Col } from '$lib/tests/TestSnippets.svelte';
Makes TypeScript flag the statement with TS2614:
That's fine, I guess. I believe this happens because of the ambient module for *.svelte. We cannot predict that a particular .svelte file will export something out of the module script. So I proceed to use // @ts-expect-error. That makes the error goes away.
However, svelte-check says:
Error: Unused '@ts-expect-error' directive.
import Layout from '$lib/tests/Layout.svelte';
// @ts-expect-error TS2614
import { children1Col } from '$lib/tests/TestSnippets.svelte';
So I can make TypeScript happy, or svelte-check happy. I cannot make both happy.
Reproduction
See previous section.
Expected behaviour
svelte-check and TypeScript should be in accordance with each other.
System Info
- OS: Windows
- IDE: VS Code
- Svelte for VS Code version: 110.3.0
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
Describe the bug
Given a .svelte file that exports snippets:
And later importing one of them:
Makes TypeScript flag the statement with TS2614:
That's fine, I guess. I believe this happens because of the ambient module for
*.svelte. We cannot predict that a particular .svelte file will export something out of the module script. So I proceed to use// @ts-expect-error. That makes the error goes away.However,
svelte-checksays:So I can make TypeScript happy, or svelte-check happy. I cannot make both happy.
Reproduction
See previous section.
Expected behaviour
svelte-checkand TypeScript should be in accordance with each other.System Info
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response