Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ElijahJohnson5 opened this issue Nov 14, 2024 · 0 comments
Open

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

ElijahJohnson5 opened this issue Nov 14, 2024 · 0 comments

Comments

@ElijahJohnson5
Copy link

ElijahJohnson5 commented Nov 14, 2024

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 ElijahJohnson5 changed the title Svelte 5 rest props with lang="ts" Svelte 5 rest props with lang="ts" gives an error Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant