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

Bug: ng test fails to run because of ng-mocks error after upgrading to typescript 4.8.2 #3514

Closed
fagia opened this issue Sep 7, 2022 · 5 comments · Fixed by #3583
Closed
Assignees
Labels
bug Something isn't working released v14.2.1

Comments

@fagia
Copy link

fagia commented Sep 7, 2022

Description of the bug

With devDependency on ng-mocks 14.2.0, after upgrading to typescript 4.8.2, ng test fails to run with the following error:

Error: node_modules/ng-mocks/index.d.ts:1447:112 - error TS2344: Type 'C' does not satisfy the constraint 'Record<string | number | symbol, any>'.

1447 export interface MockedComponentFixture<C = Record<string | number | symbol, any >, F = DefaultRenderComponent<C>> extends ComponentFixture<F> {
                                                                                                                    ~

  node_modules/ng-mocks/index.d.ts:1447:41
    1447 export interface MockedComponentFixture<C = Record<string | number | symbol, any >, F = DefaultRenderComponent<C>> extends ComponentFixture<F> {
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends Record<string | number | symbol, any>` constraint.

Everything works fine just downgrading typescript version to 4.7.4

@fagia fagia added the bug Something isn't working label Sep 7, 2022
@satanTime
Copy link
Member

Hi @fagia,

Thanks for the report.
Please, provide a min repo with the issue.

@fagia
Copy link
Author

fagia commented Sep 8, 2022

Hi @satanTime
thanks for your answer, I've been able to reproduce the same issue with ng-mocks repo itself:

  • check-out master
  • in package.json update the typescript dependency to 4.8.2
  • npm run build -- --prod
  • same error will happen

I've also tried to make few changes to ng-mocks sources to make typescript 4.8.2 happy...they seem to work but, since I do not have the full context, I'm not sure that they would not be breaking anything else... in case, the changes I've tried are attached here:
ng-mocks_issue_3514.patch.zip

satanTime added a commit that referenced this issue Sep 9, 2022
@satanTime satanTime linked a pull request Sep 9, 2022 that will close this issue
1 task
satanTime added a commit that referenced this issue Sep 9, 2022
satanTime added a commit that referenced this issue Sep 9, 2022
@satanTime
Copy link
Member

v14.2.1 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems.

@fagia
Copy link
Author

fagia commented Sep 9, 2022

Cool I can confirm that it's now working fine!
Thanks @satanTime for the quick and effective fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released v14.2.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants