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

@ngrx/effects/src/effect_creator.d.ts:12:43 - error TS2313: Type parameter 'OT' has a circular constraint. #4275

Closed
1 of 2 tasks
gclapham opened this issue Mar 11, 2024 · 17 comments · Fixed by #4296
Closed
1 of 2 tasks

Comments

@gclapham
Copy link

Which @ngrx/* package(s) are the source of the bug?

effects

Minimal reproduction of the bug/regression with instructions

When trying to compile code in an Nx monorepo I get the following Error:
12 }, DT extends DispatchType<C>, OT extends ObservableType<DT, OT>, R extends EffectResult<OT>>(source: () => R & ConditionallyDisallowActionCreator<DT, R>, config?: C): R & CreateEffectMetadata;

Expected behavior

It should not throw a TypeScript Error.
I have tried adding to the the following to the base tsconfig

  "compilerOptions": {
    "forceConsistentCasingInFileNames": true,
    "strict": false,
    "noImplicitReturns": false,
    "noFallthroughCasesInSwitch": true,
    "paths": {
      "@ngrx/effects": ["node_modules/@ngrx/effects"],
      "@ngrx/effects/*": ["node_modules/@ngrx/effects/*"]
    },
  },

There are, however, dozens of tsconfigs, as this is a monorepo. They mostly inherit form a base config, but not all.
I may be able to add it to one of those configs and have it work. It would be preferable that the code did not trigger TS type checking.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

Node : 18.19.1
OS : darwin-arm64
yarn : 1.22.21

nx (global) : 18.0.7
nx : 18.0.7
@nx/js : 18.1.0
@nx/jest : 18.1.0
@nx/linter : 18.1.0
@nx/eslint : 18.1.0
@nx/workspace : 18.1.0
@nx/angular : 18.1.0
@nx/cypress : 18.1.0
@nx/devkit : 18.1.0
@nx/eslint-plugin : 18.1.0
@nrwl/tao : 18.0.7
@nx/web : 18.1.0
@nx/webpack : 18.1.0
typescript : 5.4.2

Community plugins:
@ng-bootstrap/ng-bootstrap : 16.0.0
@ngrx/component-store : 17.1.1
@ngrx/effects : 17.1.1
@ngrx/entity : 17.1.1
@ngrx/router-store : 17.1.1
@ngrx/schematics : 17.1.1
@ngrx/store : 17.1.1
@ngrx/store-devtools : 17.1.1
ng-mocks : 12.5.1

The following packages should match the installed version of nx

  • @nx/js@18.1.0
  • @nrwl/js@18.1.0
  • @nx/jest@18.1.0
  • @nrwl/jest@18.1.0
  • @nx/linter@18.1.0
  • @nx/eslint@18.1.0
  • @nx/workspace@18.1.0
  • @nrwl/workspace@18.1.0
  • @nx/angular@18.1.0
  • @nrwl/angular@18.1.0
  • @nx/cypress@18.1.0
  • @nrwl/cypress@18.1.0
  • @nx/devkit@18.1.0
  • @nrwl/devkit@18.1.0
  • @nx/eslint-plugin@18.1.0
  • @nrwl/eslint-plugin-nx@18.1.0
  • @nx/web@18.1.0
  • @nrwl/web@18.1.0
  • @nx/webpack@18.1.0
  • @nrwl/webpack@18.1.0

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@DSerp
Copy link

DSerp commented Mar 14, 2024

This problem was actually introduced from the latest version of typescript (5.4.2), problem does not occur on the previous major release (5.3.3)

@thegtzz
Copy link

thegtzz commented Mar 14, 2024

confirm, that tsc 5.3.3 solved the problem

@EranKT
Copy link

EranKT commented Mar 14, 2024

error was solved with tsc 5.3.3

but was introduced again with angular-cli 17.3.0 today
installing angular 17.2.2 again solved the error

@thegtzz
Copy link

thegtzz commented Mar 15, 2024

error was solved with tsc 5.3.3

but was introduced again with angular-cli 17.3.0 today installing angular 17.2.2 again solved the error

as for me, tsc 5.3.3 works well with angular 17.3.0

@EranKT
Copy link

EranKT commented Mar 15, 2024

error was solved with tsc 5.3.3
but was introduced again with angular-cli 17.3.0 today installing angular 17.2.2 again solved the error

as for me, tsc 5.3.3 works well with angular 17.3.0

Also for me it works well, but when
Ngrx is installed the error returns

@rafparedis
Copy link

This error also popped up after updating to angular 17.3.0 and typescript 5.4.2.
Downgrading typescript to 5.3.3 fixed the compile error

@timdeschryver
Copy link
Member

This seems to be an issue on TypeScript's side.
See microsoft/TypeScript#57750

@EranKT
Copy link

EranKT commented Mar 15, 2024

error was solved with tsc 5.3.3
but was introduced again with angular-cli 17.3.0 today installing angular 17.2.2 again solved the error

as for me, tsc 5.3.3 works well with angular 17.3.0

Also for me it works well, but when Ngrx is installed the error returns

My mistake. I didn’t see that my typescript version was 5.4.2
Downgrade to 5.3.3 worked also for me

@johnpapa
Copy link
Contributor

error was solved with tsc 5.3.3
but was introduced again with angular-cli 17.3.0 today installing angular 17.2.2 again solved the error

as for me, tsc 5.3.3 works well with angular 17.3.0

Also for me it works well, but when Ngrx is installed the error returns

My mistake. I didn’t see that my typescript version was 5.4.2 Downgrade to 5.3.3 worked also for me

This did not work for me. Runs fine in Angular v16.x.x but with Angular 17 and even typescript 5.3.3, it fails.

@PhilFlash
Copy link

Same problem with angular 17.3.1 and the latest version typescript 5.4.3.
Downgrading typescript to 5.3.3 fixed the compile error

@ruizmarc
Copy link

ruizmarc commented Mar 25, 2024

@timdeschryver According to Typescript microsoft/TypeScript#57750 problem was fixed in 5.4.3 but it is still happing with Angular 17.3.1 and Typescript 5.4.3

@achraf-elk
Copy link

same v17.3.1 with v5.4.3 doesn't work, just brought back Typecript v5.3.3

@KevinRattan
Copy link

I've been investigating this further. The downgrade of TS works on my (intel) mac. It works on Linux. It works in Github actions. Where it does not work is when building with Docker - even using the same version of node. I've tried various base images, but all lead to the same error.

unlimit1984 added a commit to unlimit1984/home-expenses that referenced this issue Mar 31, 2024
- Downgrade ts to fix the issue
- ngrx/platform#4275
@davesmits
Copy link

They released typescript 5.4.4 today but didn't fix this issue

@EranKT
Copy link

EranKT commented Apr 4, 2024

As far as I understand NGRX need to release a version that support typescript 5.4.3 and above.
Typescript introduced a breaking change on this version.

@brandonroberts
Copy link
Member

The fix has been released with NgRx 17.2.0

@KevinRattan
Copy link

Thank you! That did the trick. Now builds for me everywhere, including in docker.

mrednic-1A added a commit to AmadeusITGroup/otter that referenced this issue Apr 26, 2024
## Proposed change

<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that is required for this change. -->

## Related issues

- 🐛 Fixes #(issue)
- 🚀 Feature #(issue)

There is a missmatch of versions between angular ngrx and tsc.
It was fixed on ngrx 17.2
Here is the tracking issue ngrx/platform#4275

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet