Commit 1e32709
fix(router): remove RouterEvent from Event union type (#46061)
41e2a68 added a `type` property on all router events, and added all type of events to the `Event` union type, but forgot to remove `RouterEvent`.
This removes the benefit of the `type` field, because it is not possible to write:
```
this.router.events.pipe(filter((event: Event): event is NavigationEnd => event.type === EventType.NavigationEnd)).subscribe(/*...*/);
```
as `RouterEvent` does not have a `type` field (hence TS complains).
This commit fixes the issue by removing `RouterEvent` from the union type.
BREAKING CHANGE: The `RouterEvent` type is no longer present in the `Event` union type representing all router event types. If you have code using something like `filter((e: Event): e is RouterEvent => e instanceof RouterEvent)`, you'll need to update it to `filter((e: Event|RouterEvent): e is RouterEvent => e instanceof RouterEvent)`.
PR Close #460611 parent 02cd490 commit 1e32709
File tree
3 files changed
+7
-11
lines changed- goldens/public-api/router
- packages/router
- src
- test
3 files changed
+7
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
637 | 636 | | |
638 | 637 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | 638 | | |
643 | 639 | | |
644 | 640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6376 | 6376 | | |
6377 | 6377 | | |
6378 | 6378 | | |
6379 | | - | |
| 6379 | + | |
6380 | 6380 | | |
6381 | 6381 | | |
6382 | 6382 | | |
| |||
6440 | 6440 | | |
6441 | 6441 | | |
6442 | 6442 | | |
6443 | | - | |
| 6443 | + | |
6444 | 6444 | | |
6445 | 6445 | | |
6446 | 6446 | | |
| |||
0 commit comments