Title: Canonical: Marking @Input as required · Issue #37706 · angular/angular · GitHub
Open Graph Title: Canonical: Marking @Input as required · Issue #37706 · angular/angular
X Title: Canonical: Marking @Input as required · Issue #37706 · angular/angular
Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description There is a long history of discussion about whether / how to have the compiler enforce that specific inputs are provided to components: #11904 #1815...
Open Graph Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description There is a long history of discussion about whether / how to have the compiler enforce that specific inputs ...
X Description: 🚀 feature request Relevant Package This feature request is for @angular/core Description There is a long history of discussion about whether / how to have the compiler enforce that specific inputs ...
Opengraph URL: https://github.com/angular/angular/issues/37706
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Canonical: Marking @Input as required","articleBody":"# 🚀 feature request\r\n\r\n### Relevant Package\r\nThis feature request is for @angular/core\r\n\r\n\r\n### Description\r\nThere is a long history of discussion about whether / how to have the compiler enforce that specific inputs are provided to components: #11904 #18156 #24879 #28403 #30974 \r\n\r\nHowever, all of those are now closed and locked. They contain some advice about how to mitigate the problem, or kick the can down the road (\"One day I hope we'll be able to do this. That day is not today.\"), but thanks to the lock-bot none of them can be used to continue the conversation, so I guess we need yet another issue, because I believe the problem still exists.\r\n\r\n\r\n### Describe the solution you'd like\r\nIt should be possible to annotate inputs such that using a component in a template without providing a value for that input is a compile-time error. Template checking has come a long way, and it's already possible for the compiler to flag providing the wrong type as an argument. Combine with the `strictPropertyInitializers` flag, and such a check could rely on the existing `!` assertion operator.\r\n\r\n\r\n### Describe alternatives you've considered\r\nThe best approach I've seen while reviewing the above issues is specifying the required attributes in the `selector` component metadata, but a) apparently that won't catch passing `null` or `undefined` to an Input that not defined with a type that includes those values, and b) that appears to break certain test harnesses? Also, I haven't started using `strictTemplates` / `fullTemplateTypeCheck` yet due to some problems in previous versions with narrowing on `*ngIf` that may or may not have been resolved -- those existing capabilities may address some or all of this need.","author":{"url":"https://github.com/thw0rted","@type":"Person","name":"thw0rted"},"datePublished":"2020-06-24T16:47:30Z","url":"https://github.com/angular/angular/issues/37706"}
| 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:6414eefb-2c35-facf-338d-eb0ca2a13f94 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDEE:D5AA4:10F8EE7:16A8FA8:6B010DD8 |
| html-safe-nonce | 90dcce2adb09953348aed6122aa2d59b0edefdf58209182043aaf8f4cf228afd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREVFOkQ1QUE0OjEwRjhFRTc6MTZBOEZBODo2QjAxMEREOCIsInZpc2l0b3JfaWQiOiI3NjIyNTE1Mjk5Mzg4MDM0NTIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5dd819606c9af4eddfa7fee64229e9fe00185b256fc4135cc0d12f12e23099f1 |
| hovercard-subject-tag | issue:644760644 |
| 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/37706/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f7116c52cee59031f3d0f73494fb983ba4130b9f9da2ea2750b5d7fe504afd4c/angular/angular/issues/37706 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f7116c52cee59031f3d0f73494fb983ba4130b9f9da2ea2750b5d7fe504afd4c/angular/angular/issues/37706 |
| og:image:alt | 🚀 feature request Relevant Package This feature request is for @angular/core Description There is a long history of discussion about whether / how to have the compiler enforce that specific inputs ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thw0rted |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width