Skip to content

Commit 923f448

Browse files
authored
(docs) hide/remove ComponentEvents doc
Until it's decided (through the RFC) on how to proceed
1 parent f17040d commit 923f448

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

docs/preprocessors/typescript.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,34 +68,6 @@ This will make sure that if you use `dispatch` that you can only invoke it with
6868

6969
Note though that this will _NOT_ make the events strict so that you get type errors when trying to listen to other events when using the component. Due to Svelte's dynamic events creation, component events could be fired not only from a dispatcher created directly in the component, but from a dispatcher which is created as part of another import. This is almost impossible to infer.
7070

71-
If you want strict events, you can do so by defining a reserved `interface` (_NOT_ `type`) called `ComponentEvents`:
72-
73-
```html
74-
<script lang="ts">
75-
interface ComponentEvents {
76-
click: MouseEvent;
77-
hello: CustomEvent<boolean>;
78-
}
79-
80-
// ...
81-
</script>
82-
```
83-
84-
Doing this will give you autocompletion for these events as well as type safety when listening to the events in other components.
85-
86-
If you want to be sure that the interface definition names correspond to your dispatched events, you can use computed property names:
87-
88-
```html
89-
<script lang="ts">
90-
const hello = 'hello';
91-
interface ComponentEvents {
92-
[hello]: CustomEvent<boolean>;
93-
}
94-
// ...
95-
dispatch(hello, true);
96-
</script>
97-
```
98-
9971
## Troubleshooting / FAQ
10072

10173
### I cannot use TS inside my script even when `lang="ts"` is present

0 commit comments

Comments
 (0)