Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

238
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda