svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

Svelte 5 rest props with lang="ts" gives an error

Open ElijahJohnson5 opened this issue 1 year ago • 0 comments

Describe the bug When using the rest props like so let { ...rest } = $props(); inside of a svelte file with <script lang="ts> an error shows up saying

`p` has already been declaredsvelte(declaration_duplicate)

To Reproduce Create a svelte component like the following

<script lang="ts">
	let { ...rest }: { test: string } = $props();
</script>

I am using esbuild-svelte but the error goes away if I don't use svelte-preprocess

✘ [ERROR] `p` has already been declared [plugin esbuild-svelte]

    second.svelte:6:24:
      6 │   let { ...rest } = $props();

Expected behavior I should be able to use the rest props syntax in a typescript svelte file

Information about your project:

OS: Ubuntu Linux

svelte-preprocess version 6.0.3

Additional Info The error also shows up for me when using vscode with the Svelte for VSCode extension

ElijahJohnson5 avatar Nov 14 '24 05:11 ElijahJohnson5