Skip to content

docs: update web-components.md NOTE code block #3185

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

Merged
merged 2 commits into from
Apr 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/guide/extras/web-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ declare module 'vue' {

Here is the recommended way to enable type checking in SFC templates of Custom Elements that are not built with Vue.

> [!Note]
> This approach is one possible way to do it, but it may vary depending on the
> framework being used to create the custom elements.
:::tip Note
- This approach is one possible way to do it, but it may vary depending on the
- framework being used to create the custom elements.
:::

Suppose we have a custom element with some JS properties and events defined, and it is shipped in a library called `some-lib`:

Expand Down Expand Up @@ -389,11 +390,12 @@ type VueEmit<T extends EventMap> = EmitFn<{
}>
```
> [!Note]
> We marked `$props` and `$emit` as deprecated so that when we get a `ref` to
> a custom element we will not be tempted to use these properties, as these
> properties are for type checking purposes only when it comes to custom elements.
> These properties do not actually exist on the custom element instances.
:::tip Note
- We marked `$props` and `$emit` as deprecated so that when we get a `ref` to
- a custom element we will not be tempted to use these properties, as these
- properties are for type checking purposes only when it comes to custom elements.
- These properties do not actually exist on the custom element instances.
:::
Using the type helper we can now select the JS properties that should be exposed for type checking in Vue templates:
Expand Down