Open
Description
Describe the bug
the following code is correct, but will generate a false error
import { Observable, of, tap } from 'rxjs';
let test$: Observable<number> = of(1).pipe(
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
tap(() => 1),
);
Error:
Type 'Observable<unknown>' is not assignable to type 'Observable<number>'.
Type 'unknown' is not assignable to type 'number'.ts(2322)
commenting any of tap()
blocks causes the error to be disappeared.
also, explicitly set the type again resolves the error. but TS can infer the type easily
of(1).pipe( ... ) as Observable<number>
Expected behavior
no error
Reproduction code
No response
Reproduction URL
https://stackblitz.com/edit/rxjs-jvajmd?devtoolsheight=60&file=index.ts,tsconfig.json
Version
next
Environment
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels