Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs: remove duplicate type casting in testing guide #62142

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bampakoa
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from alxhub June 19, 2025 07:49
@angular-robot angular-robot bot added the area: docs Related to the documentation label Jun 19, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 19, 2025
Comment on lines 306 to 308
private queryAll<T>(selector: string): T[] {
return harness.routeNativeElement!.querySelectorAll(selector) as any as T[];
return harness.routeNativeElement!.querySelectorAll(selector) as T[];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  private queryAll<T extends Element>(selector: string): NodeListOf<T> {
    return harness.routeNativeElement!.querySelectorAll(selector) as NodeListOf<T>;
  }

Would be a correct typing here.
Currently your suggestion throws as querySelectorAll does not return an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used it in my projects with T[] and it works without errors. How can I reproduce the error that is thrown in your case?

Copy link
Member

@JeanMeche JeanMeche Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using it in an application built with Angular 18.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well without a repro it's hard to understand what's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants