-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: warn when using rest or identifier in custom elements without props option #16003
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
Conversation
🦋 Changeset detectedLatest commit: 9c4db99 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
<!-- A.svelte -->
<svelte:options customElement={{
tag: 'a-btn',
props: {
name: {type: 'String'},
}
}}/>
<script lang="ts">
import B from './B.svelte'
const props: {name: string} = $props()
</script>
<B name={props.name}/><!-- B.svelte -->
<script lang="ts">
const props: {name: string} = $props()
</script>
<button>{props.name}</button>Perhaps a trigger warning shouldn't be issued for file https://stackblitz.com/edit/vitejs-vite-1tpdpcqa?file=src%2FB.svelte
|
|
Please open a new issue, comments on merged PRs will get lost |

Sprouted from this bsky conversation
It could be quirky to debug such things so I think a warning could be nice if you have a Rest element or an Identifier as the declarator of
$propsAND don't have apropsoption forcustomElementOptions.I've added three test that maybe is too much but wanted to capture all three scenarios.
Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint