'Converting from do() to tap() from Angular 2 to Angular 6

I am trying to implement Server Side Pagination for a Grid in Angular 6 with Kendo Grid

The code below is from Angular 2 which I have taken from the below site

https://www.c-sharpcorner.com/article/server-side-paging-in-kendo-grid-for-angular-2/

public ngAfterViewInit(): void {  
  this.grid.dataStateChange  
      .do(({ skip, take }: DataStateChangeEvent) => {  
          this.skip = skip;  
          this.pageSize = take;  
      })  
      .subscribe(x => this.service.query(x));  
}

Because I am using Angular 6, it is expecting tap instead of do in the above code.

Currently I am getting red swiggly for do and the error says as below

Property 'do' does not exist on type 'EventEmitter<DataStateChangeEvent>'

How can I convert it into a usable code by using tap here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source