question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: ofType doesn't work

See original GitHub issue

Versions:

  • ts-action@11.0.0
  • ts-action-operators@9.1.1

I have a scenario:

import { action, props } from 'ts-action';
import { ofType } from 'ts-action-operators';

export const authorized = action(
  '[Auth Epic] authorized',
  props<{ user: User; token: string }>(),
);

const authorizedEpic = (action$, state$) =>
  action$.pipe(
    ofType(authorized),
    distinctUntilChanged((a, b) => a.token === b.token),
    ...
  );

Complier complains: Property 'token' does not exist on type '{}'..

I have previously worked with NgRx and had no issues like that. Is there something I am doing wrong or is ofType operator broken?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cartantcommented, Nov 17, 2019

The inference fails because pipe is called on any - not on Observable - so it cannot match the pipe method on Observable. That means there is no relationship between the arguments passed to pipe, so the output of ofType has no affect on distinctUntilChanged. When action$ is typed correctly, a pipe signature is matched and the inference flows as you’d expect it to.

0reactions
Bielik20commented, Nov 18, 2019

Ok, I did not consider the problem was on the pipe level, thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngrx store getting error as Property 'ofType' does not exist on ...
ERROR in src/app/store/effects/authentication.effects.ts(25,7): error TS2339: Property 'ofType' does not exist on type 'Actions<Action>'. src/ ...
Read more >
Bug(@ngrx/Effect): Cannot read property 'ofType' of undefined ...
I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [X] Bug report [...
Read more >
Troubleshooting - redux-observable
When you're using ofType operator for filtering, returned observable won't be correctly narrowed within Type System, because its not capable of doing so...
Read more >
Solved: Re: Problem with a field of type URL (bug?) - Google Cloud ...
Hi, I've got a problem with a calculated field (type url) in one of my apps. As you can see here, I compose...
Read more >
Why do I get an "Error using eval: Undefined function ...
1) First, locate your pathdef.m file. · 2) If the above does not resolve the issue then your pathdef.m file may be corrupted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found