[IMP] component: allow using TypeScript type hints (#758)

This commit is contained in:
Bruno Boi
2020-10-20 16:30:09 +02:00
committed by GitHub
parent b08cc1d084
commit 4724652533
2 changed files with 17 additions and 4 deletions
+13
View File
@@ -78,6 +78,19 @@ The `t-on` directive allows to prebind its arguments. For example,
Here, `expr` is a valid Owl expression, so it could be `true` or some variable
from the rendering context.
### Type Hinting
Note that if you work with Typescript, the `trigger` method is generic on the type of the payload.
You can then describe the type of the event, so you will see typing errors...
```typescript
this.trigger<MyCustomPayload>('my-custom-event', payload);
```
```typescript
myCustomEventHandler(ev: OwlEvent<MyCustomPayload>) { ... }
```
## Inline Event Handlers
One can also directly specify inline statements. For example,