-
Notifications
You must be signed in to change notification settings - Fork 3
fix: added types for elementRef (#DS-4221) #1028
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR applies the kbqInjectElementRef()
utility function across the codebase to replace direct usage of inject(ElementRef)
. The change improves type safety by ensuring consistent ElementRef<HTMLElement>
typing throughout the components.
Key changes:
- Replaces
inject(ElementRef)
withkbqInjectElementRef()
for proper HTMLElement typing - Updates public API signatures to reflect more specific return types
- Includes complementary use of
kbqInjectNativeElement()
for direct native element access
Reviewed Changes
Copilot reviewed 56 out of 56 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
tools/public_api_guard/components/*.api.md | Updates public API signatures to reflect proper HTMLElement typing for ElementRef properties |
packages/components/*/**.ts | Replaces ElementRef injection with kbqInjectElementRef() utility function |
packages/docs-examples/components/*/**.ts | Applies the same ElementRef utility replacement in example code |
apps/docs/src/app/components/*/**.ts | Updates documentation components to use the new utility function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Visit the preview URL for this PR (updated for commit 8ef9208): https://koobiq-next--prs-1028-c9le72t3.web.app (expires Wed, 01 Oct 2025 10:53:42 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
Это лишняя обертка. Там где вылезли ошибки с типами нужно добавить типы. Из-за одного места делать подобные вещи не стоит. |
я так не считаю, во первых эта запись читабельней // before
readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef<HTMLElement>);
//after
readonly elementRef = kbqInjectElementRef(); во вторых она уже выявила несколько мест с потенциальными рантайм ошибками подобный подход не редкость - пример |
Я уже об этом говорил на примере оберток с провайдерами...
|
ad588a3
to
a7393f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 90 out of 90 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
No description provided.