Topic icon

Computer Programming

0
After updating angular to the latest version, you might get this error:


Argument of type 'MonoTypeOperatorFunction<RouterEvent>' is not assignable to parameter of type 'OperatorFunction<Event_2, RouterEvent>'.
  Types of parameters 'source' and 'source' are incompatible.
    Type 'Observable<Event_2>' is not assignable to type 'Observable<RouterEvent>'.
      Type 'Event_2' is not assignable to type 'RouterEvent'.
        Type 'RouteConfigLoadStart' is missing the following properties from type 'RouterEvent': id, url

This error occurs at line where to subscribe to router events, that looks something like this:


this.routeSub = this.router.events
   .pipe(
    filter(
     (event: RouterEvent) => event instanceof NavigationStart
    ),
    tap(() => this.trigger.closePanel())
   )
   .subscribe();


Solution 1:
In recent version of angular, router.events emit a generic Event and not RouterEvent. Hence to correctly fix the issue import the Event from the angular/router module and replace RouterEvent with Event.

Here is how you do it:


import { NavigationStart, Router, Event} from "@angular/router";
this.routeSub = this.router.events
   .pipe(
    filter(
     (event: Event) => event instanceof NavigationStart
    ),
    tap(() => this.trigger.closePanel())
   )
   .subscribe();


Solution 2:
If you really don't care about explicit type(e.g. in the filter function above), just remove the RouterEvent type, and compiler will implicitly assign the Event type to it.
Wrote answer · 5/27/2023
Karma · 1435
0
        

Robots can be useful not only for Thai restaurants in Chennai, but also for visitors. Thanks to their fast work, the service to visitors will accelerate. Food will be served in a more consistent manner, which tends to leave a good impression and lead to repeat visits.

       

For more information, visit our website - www.robotrestaurantomr.in


Wrote answer · 9/16/2022
Karma · 230
0

Here are four characteristics of a computer:

  1. Speed
    Computers can perform operations at incredible speeds, far exceeding human capabilities. They are measured in Hertz, and can perform millions or even billions of calculations per second.
  2. Accuracy
    Computers are highly accurate and consistent, provided they are given the correct input and instructions. Errors are usually due to human error, incorrect data, or faulty programming.
  3. Storage Capacity
    Computers can store vast amounts of data and information. This allows users to keep large files, programs, and operating systems on the machine for later use. Storage is measured in bytes.
  4. Automation
    Once a computer is given a program or set of instructions, it can perform the task automatically without human intervention. This automation reduces the need for manual labor and allows for efficient processing of repetitive tasks.
Wrote answer · 3/14/2025
Karma · 40
1
Both dir and lang attributes are supported in inline and block elements.
So you can use it on span as well as div, td, tr, etc.

For better structuring of your content, it's recommended that you use the dir attribute on block elements.

To see how the dir element is applied on table, see following link:
https://www.w3.org/International/questions/qa-html-dir#tables
Wrote answer · 3/9/2022
Karma · 1435
0
Where should we walk
Wrote answer · 2/14/2022
Karma · 0
0
The average is called mean in statistical language. To be more accurate, it's called arithmetic mean.
Wrote answer · 8/2/2022
Karma · 1435