René's URL Explorer Experiment


Title: Several issues with strict property checks and definite assignement assertion · Issue #20740 · microsoft/TypeScript · GitHub

Open Graph Title: Several issues with strict property checks and definite assignement assertion · Issue #20740 · microsoft/TypeScript

X Title: Several issues with strict property checks and definite assignement assertion · Issue #20740 · microsoft/TypeScript

Description: TypeScript Version: 2.7.0-dev.20171214 This issue is about the new strict property checks #20075 and definite assignement assertion #20166. Anders Hejlsberg (@ahejlsberg) Mohamed Hegazy (@mhegazy) Daniel Rosenwasser (@DanielRosenwasser) ...

Open Graph Description: TypeScript Version: 2.7.0-dev.20171214 This issue is about the new strict property checks #20075 and definite assignement assertion #20166. Anders Hejlsberg (@ahejlsberg) Mohamed Hegazy (@mhegazy) ...

X Description: TypeScript Version: 2.7.0-dev.20171214 This issue is about the new strict property checks #20075 and definite assignement assertion #20166. Anders Hejlsberg (@ahejlsberg) Mohamed Hegazy (@mhegazy) ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/20740

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Several issues with strict property checks and definite assignement assertion","articleBody":"**TypeScript Version:**  2.7.0-dev.20171214\r\n\r\nThis issue is about the new strict property checks #20075 and definite assignement assertion #20166.\r\n\r\n@ahejlsberg @mhegazy @DanielRosenwasser @RyanCavanaugh Did you guys test this new feature on real world projects ? Because as it is now, it could lead to a huge (negative ?) impact. It may need more thinking/fixing before landing in stable.\r\n\r\nAs VS Code Insiders now uses TS 2.7, when opening my Angular project (which is in strict mode), I discovered with surprise that now half my files contain errors (all my components) due to this new feature. And trying to get compliant with this led to many problems, some of them with no solution currently.\r\n\r\nTake this very simple Angular code : \r\n\r\n```typescript\r\nimport { Component, Input } from '@angular/core';\r\nimport { Movie } from './movie';\r\n\r\n@Component({\r\n  selector: 'app-movie',\r\n  template: `\u003cdiv>\u003ch1>{{movie.title}}\u003c/h1>\u003c/div>`\r\n})\r\nexport class MovieComponent {\r\n\r\n  @Input() movie: Movie;\r\n\r\n}\r\n```\r\n\r\n`movie` property now raises an error as TS can't know it will be initialized by an Angular mecanism.\r\n\r\nLet's look at the solutions to be compliant with the new strict mode feature : \r\n\r\n1. Putting default values everywhere : \r\n```typescript\r\n@Input() movie: Movie | null = null;\r\n```\r\n\r\nUnfortunately, that's not possible here, as an object is expected. Only solution would be to set `null` by default, but then strict mode would raise another error due to `strictNullChecks`. So you would allow `null` as a type, but then TS will scream everywhere you use `movie` inside the class and force you to check if it's not null, when you already know very well it's not. So it's a mess.\r\n\r\nAnother problem : this feature checks the constructor, but in Angular you often must wait another callback like `ngOnInit` to do your initial stuff.\r\n\r\n2. Use the new definite assignement assertion : \r\n```typescript\r\n@Input() movie!: Movie;\r\n```\r\n\r\nFirst, in Angular, it would mean quite all the components properties will need this \"hack\". As in reality, the code is OK, it seems to me it's a too overwhelming solution to just calm down TypeScript. It could lead people to never adopt this feature, and then complicate the usage of the combined `strict` option, as we would need to just activate some individual strict features. Did you guys ask the Angular team what they think about this ?\r\n\r\nSecond, it's now Angular which raises an error in the template, saying `Identifier 'title' is not defined. '\u003canonymous>' does not contain such a member`. We should verify before landing that the Angular language service is able to fix this issue. @chuckjaz \r\n\r\nThird, TS Lint is not happy too : it's saying `Missing semicolon (semicolon)` just after the `!`. It also should be fixed before this feature is landing to stable.\r\n","author":{"url":"https://github.com/cyrilletuzi","@type":"Person","name":"cyrilletuzi"},"datePublished":"2017-12-17T18:52:52Z","url":"https://github.com/microsoft/TypeScript/issues/20740"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:80cc14ec-c463-20e6-2e77-dd000ee5f247
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id82EA:10DACD:6394A0:86592A:6B00D497
html-safe-nonce4812e5dfbaae36c2979ba115ff42b7a5c2c9e0a32e62842331b8adfb9f0f6c5d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkVBOjEwREFDRDo2Mzk0QTA6ODY1OTJBOjZCMDBENDk3IiwidmlzaXRvcl9pZCI6IjgzNDI0NjIyNzE4NzE1NzEwOTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd30d0b001ab555fd089f54742b24e6b403d8cd9f727e245b1ff85d18c39f8b93
hovercard-subject-tagissue:282714920
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/20740/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e6e41143e4bf44f26f6595b6206fad1ac2743bda67ac832acf143d6158442a68/microsoft/TypeScript/issues/20740
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e6e41143e4bf44f26f6595b6206fad1ac2743bda67ac832acf143d6158442a68/microsoft/TypeScript/issues/20740
og:image:altTypeScript Version: 2.7.0-dev.20171214 This issue is about the new strict property checks #20075 and definite assignement assertion #20166. Anders Hejlsberg (@ahejlsberg) Mohamed Hegazy (@mhegazy) ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecyrilletuzi
hostnamegithub.com
expected-hostnamegithub.com
Nonea481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release84c8c5cc25e2fb7f2308428458538436baecc6d2
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/20740#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F20740
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F20740
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/20740
Reloadhttps://github.com/microsoft/TypeScript/issues/20740
Reloadhttps://github.com/microsoft/TypeScript/issues/20740
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/20740
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/20740
Several issues with strict property checks and definite assignement assertionhttps://github.com/microsoft/TypeScript/issues/20740#top
DiscussionIssues which may not have code impacthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Discussion%22
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Dec 17, 2017https://github.com/microsoft/TypeScript/issues/20740#issue-282714920
#20075https://github.com/microsoft/TypeScript/pull/20075
#20166https://github.com/microsoft/TypeScript/pull/20166
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
Chuck Jazdzewski (@chuckjaz)https://github.com/chuckjaz
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Dec 17, 2017https://github.com/microsoft/TypeScript/issues/20740#event-1391169342
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Dec 17, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352288799
#14486https://github.com/microsoft/TypeScript/pull/14486
Chuck Jazdzewski (@chuckjaz)https://github.com/chuckjaz
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352415685
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352488147
#20166https://github.com/microsoft/TypeScript/pull/20166
ambient decoratorshttps://github.com/Microsoft/TypeScript/issues/2900
long term roadmaphttps://github.com/Microsoft/TypeScript/wiki/Roadmap#future
#20166https://github.com/microsoft/TypeScript/pull/20166
Dojo (@dojo)https://github.com/dojo
https://github.com/chuckjaz
Chuck Jazdzewski (chuckjaz)https://github.com/chuckjaz
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352498537
Chuck Jazdzewski (@chuckjaz)https://github.com/chuckjaz
Cyrille Tuzi (@cyrilletuzi)https://github.com/cyrilletuzi
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352506135
Dojo (@dojo)https://github.com/dojo
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352509499
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352523992
Chuck Jazdzewski (@chuckjaz)https://github.com/chuckjaz
Cyrille Tuzi (@cyrilletuzi)https://github.com/cyrilletuzi
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
DiscussionIssues which may not have code impacthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Discussion%22
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#event-1392766809
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Dec 18, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352531092
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Dec 19, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352680888
https://github.com/chuckjaz
Chuck Jazdzewski (chuckjaz)https://github.com/chuckjaz
on Dec 20, 2017https://github.com/microsoft/TypeScript/issues/20740#issuecomment-352929023
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Jan 26, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-360781153
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jan 29, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-361345154
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jan 29, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-361346918
#8476https://github.com/microsoft/TypeScript/issues/8476
https://github.com/tinganho
Tingan Ho (tinganho)https://github.com/tinganho
on Feb 1, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-362383042
Kitson Kelly (@kitsonk)https://github.com/kitsonk
https://github.com/craigsmitham
Craig Smitham (craigsmitham)https://github.com/craigsmitham
on Feb 8, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-364186120
Immutable.js record types with typescripthttps://spin.atomicobject.com/2016/11/30/immutable-js-records-in-typescript/
https://github.com/cyrilletuzi
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
on Jun 7, 2018https://github.com/microsoft/TypeScript/issues/20740#issuecomment-395568894
Cyrille Tuzi (cyrilletuzi)https://github.com/cyrilletuzi
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 7, 2018https://github.com/microsoft/TypeScript/issues/20740#event-1669598436
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/20740
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/20740
DiscussionIssues which may not have code impacthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Discussion%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.