Pipeable operators.md code sample causing TS compliation errors out of the box

Documentation Related To Component:

pipeableOperators.md

npm list rxjs
+-- @angular-devkit/build-angular@0.8.5
| +-- @angular-devkit/architect@0.8.5
| | `-- rxjs@6.2.2
| +-- @angular-devkit/build-webpack@0.8.5
| | `-- rxjs@6.2.2
| +-- @angular-devkit/core@0.8.5
| | `-- rxjs@6.2.2
| +-- @ngtools/webpack@6.2.5
| | `-- rxjs@6.2.2
| `-- rxjs@6.2.2
+-- @angular/cli@6.2.5
| +-- @angular-devkit/schematics@0.8.5
| | `-- rxjs@6.2.2
| +-- @schematics/update@0.8.5
| | `-- rxjs@6.2.2
| `-- rxjs@6.2.2
`-- rxjs@6.3.3

Please check those that apply

  • typo
  • documentation doesn’t exist
  • documentation needs clarification
  • error(s) in example
  • needs example

Description Of The Issue

Current example is causing Typescript errors:

const starter = of(1);

const takeEveryNthSimplest = (n: number) => filter((value, index) => index %% n === 0);

const takeEveryNthSimple = (n: number) => <T>(source: Observable<T>) =>
  source.pipe(filter((value, index) => index %% n === 0 ));

starter.pipe(
  takeEveryNthSimplest(1),
  takeEveryNthSimple(2)
);

result:

image

simplest doesn’t work in my case because i’m try to create a superset operator that encapsulates a few sub-operators

1 possible answer(s) on “Pipeable operators.md code sample causing TS compliation errors out of the box