Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Why property does not exist on type in rxjs pipe function?

Why I losing the type in my pipe function? How to fix that?

Property 'n' does not exist on type '{}'

stackblitz

import { of, map, Observable, Subject, pipe, tap } from 'rxjs';
import { exhaustMap, withLatestFrom } from 'rxjs/operators';

const action = new Subject<{ n: number }>();
const id$ = of(1);

const bar = () =>
  pipe(
    withLatestFrom(id$),
    exhaustMap(([{ n }, id]) => of([n, id])), // <--- Property 'n' does not exist on type '{}'
    tap(() => {
      console.log('in bar pipeline');
    })
  );

const foo = action.pipe(bar());

foo.subscribe();

action.next({ n: 1 });
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

pipe infers all types from passed parameters. Take a look on https://github.com/ReactiveX/rxjs/blob/master/src/internal/util/pipe.ts

Try to specify type for first parameter for auto-inferring for all.

withLatestFrom<{ n: number }, number[]>(id$),
about 4 years ago · Juan Pablo Isaza Report

0

Add the proper data type:

const bar = () =>
  pipe(
    withLatestFrom(id$),
    exhaustMap(([{ n }, id]: [ {n: number}, number ]) => of([n, id]))
    tap(() => {
      console.log('in bar pipeline');
    })
  );
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!