Skip to content

Issue when running tests: "Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments." #348

Closed
@arhill05

Description

@arhill05

Attempting to run my tests with ng test and I immediately get an error upon importing from '@angular/testing-library'

The code in question:

import { render } from "@testing-library/angular";

The error in full:

Error: node_modules/@testing-library/angular/src/lib/testing-library.d.ts:10:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

10     static ɵcmp: i0.ɵɵComponentDeclaration<WrapperComponent, "atl-wrapper-component", never, {}, {}, never, never, false, never>;

Removing the import from my test allows the build to pass.

package.json contents:

{
  "name": "...",
  "version": "0.0.0",
  "scripts": {
    ...
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.2.0",
    "@angular/cdk": "~14.2.6",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/material": "~14.2.6",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    ...
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.3",
    "@angular/cli": "~14.2.3",
    "@angular/compiler-cli": "^14.2.0",
    "@testing-library/angular": "^13.0.1",
    "@types/jasmine": "~4.0.0",
    "eslint-config-prettier": "^8.5.0",
    "husky": "^8.0.2",
    "jasmine-core": "~4.3.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "karma-sonarqube-reporter": "^1.4.0",
    "lint-staged": "^13.1.0",
    "prettier": "^2.8.1",
    "typescript": "~4.7.2"
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions