Title: inject of ElementRef does not use generic type for the returned type inference · Issue #53894 · angular/angular · GitHub
Open Graph Title: inject of ElementRef does not use generic type for the returned type inference · Issue #53894 · angular/angular
X Title: inject of ElementRef does not use generic type for the returned type inference · Issue #53894 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Consider the example injection of the ElementRef with a specified generic type: // OK: hostEl is of type ElementRef
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Consider the example injection of the ElementRef with a specified generic type: // OK: hostEl is of ...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Consider the example injection of the ElementRef with a specified generic type: // OK: hostEl is of ...
Opengraph URL: https://github.com/angular/angular/issues/53894
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"inject of ElementRef does not use generic type for the returned type inference","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\ncore\r\n\r\n### Is this a regression?\r\n\r\nNo\r\n\r\n### Description\r\n\r\nConsider the example injection of the `ElementRef` with a specified generic type:\r\n\r\n```typescript\r\n // OK: hostEl is of type ElementRef\u003cHTMLElement>, as expected\r\n hostElExplicit = inject\u003cElementRef\u003cHTMLElement>>(ElementRef);\r\n\r\n // KO: hostEl is of type ElementRef\u003cany>, expecting ElementRef\u003cHTMLElement>\r\n hostElInfered = inject(ElementRef\u003cHTMLElement>);\r\n```\r\n\r\nIdeally ` inject(ElementRef\u003cHTMLElement>)` would have the return type of `ElementRef\u003cHTMLElement>`.\r\n\r\nThe fix is likely around the type definition for the `ProviderToken`.\r\n\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\nhttps://stackblitz.com/edit/stackblitz-starters-p38xn9\r\n\r\n","author":{"url":"https://github.com/pkozlowski-opensource","@type":"Person","name":"pkozlowski-opensource"},"datePublished":"2024-01-12T11:40:32Z","url":"https://github.com/angular/angular/issues/53894"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5573b90a-ae0d-fdc3-00e1-6d6d01a4bae2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFFC:15F7F4:99CE12:C722F2:6B0632A0 |
| html-safe-nonce | d02a90f9bf17706f84c4a6c1c7898dc0801ed3972a61b07b7bf05ddd8be1838a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkZDOjE1RjdGNDo5OUNFMTI6QzcyMkYyOjZCMDYzMkEwIiwidmlzaXRvcl9pZCI6IjM0NjMwODQzNzU1MjI4MDIyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9a05c2c38d63272babbebe68f10e6ba1a811f0b4745534d92651d67eb86eb369 |
| hovercard-subject-tag | issue:2078649016 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/53894/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b817e7d453fb731571603b0273da155ec60351a3bd8746760b57c3e1141dada6/angular/angular/issues/53894 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b817e7d453fb731571603b0273da155ec60351a3bd8746760b57c3e1141dada6/angular/angular/issues/53894 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description Consider the example injection of the ElementRef with a specified generic type: // OK: hostEl is of ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pkozlowski-opensource |
| hostname | github.com |
| expected-hostname | github.com |
| None | c3584c853cd39700ecff6e2cf8364295ffdb5313e571046c41cd2479270f7df0 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9eb3bb1597d09170a5f282cd38ae376dee1a5ec1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width