docs: Adjust docs for snippet typing to be more explicit #15167
+11
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found the Snippet docs a little opaque in regard to typing. I think in this case it's best to be explicit with the typing, rather than use a generic, because the shape of the example is consistent throughout the page.
As an aside, I might even suggest an "Advanced patterns" section with Snippets that shows how snippet parameters can be spread to a render since that is extremely common in Svelte components in practice. I'm happy to construct an example like that if needed in a second PR.
This is only my second PR against the docs, so please let me know if I've made any stylistic or pattern errors.
Before submitting the PR, please make sure you do the following
It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcsfeat:
,fix:
,chore:
, ordocs:
.Ideally, include a test that fails without this PR but passes with it.If this PR changes code withinpackages/svelte/src
, add a changeset (npx changeset
).Tests and linting
Run the tests withpnpm test
and lint the project withpnpm lint