Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters not assignable to parameter of type #37

Open
tibdev78 opened this issue Jan 31, 2023 · 2 comments
Open

Parameters not assignable to parameter of type #37

tibdev78 opened this issue Jan 31, 2023 · 2 comments

Comments

@tibdev78
Copy link

tibdev78 commented Jan 31, 2023

Which @ngneat/effects-* package(s) are the source of the bug?

effects

Is this a regression?

No

Description

I'm trying to put ngneat/effects on my ionic project but I get an error I don't understand, when I put the 'ofType' operator to observe my action it triggers this error:

Argument of type '(source: Observable<Action<string>>) => Observable<{ type: "[Spending] Load Spendings"; }>' is not assignable to parameter of type 'OperatorFunction<Action, { type: "[Spending] Load Spendings"; }>'.

it tells me it's a ts error, so I try to change the node version but nothing I still get the same error.

My action:

import { actionsFactory } from "@ngneat/effects";

const spendingActions = actionsFactory('Spending');

const loadSpending = spendingActions.create('[Spending] Load Spendings');

export { loadSpending };

my effect:

loadingSpendings$ = createEffect((actions) => 
        actions.pipe(
            ofType(spendingActions.loadSpending), // error triggered here
            mergeMap(() => 
                this.spendingService.loadSpending()
            ),
            tap(setSpendings),
        )
    )

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

Node version: 18.10
Ts version: 4.8.4

Anything else?

No response

Do you want to create a pull request?

No

@NetanelBasal
Copy link
Member

Please reproduce it on stackblitz

@royling
Copy link

royling commented Mar 4, 2023

This happened to me, too.
I believe it's because the ts-action-operators (which exports the ofType operator) is requiring the local rxjs lib, I can see the below structure in the node_modules directory:
image

with a global dep of rxjs in the project, there're always such different references to the same type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants