René's URL Explorer Experiment


Title: Aggressive "used before assigned" with strictNullChecks · Issue #9757 · microsoft/TypeScript · GitHub

Open Graph Title: Aggressive "used before assigned" with strictNullChecks · Issue #9757 · microsoft/TypeScript

X Title: Aggressive "used before assigned" with strictNullChecks · Issue #9757 · microsoft/TypeScript

Description: TypeScript Version: 2.0.0 (beta) Code // @strictNullChecks: true function on(event: string, callback: () => void): { destroy(): void; } { return { destroy() { /* nothing */ } }; } const handle = on('example', () => { handle.destroy(); //...

Open Graph Description: TypeScript Version: 2.0.0 (beta) Code // @strictNullChecks: true function on(event: string, callback: () => void): { destroy(): void; } { return { destroy() { /* nothing */ } }; } const handle = on...

X Description: TypeScript Version: 2.0.0 (beta) Code // @strictNullChecks: true function on(event: string, callback: () => void): { destroy(): void; } { return { destroy() { /* nothing */ } }; } const handle =...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Aggressive \"used before assigned\" with strictNullChecks","articleBody":"**TypeScript Version:**  2.0.0 (beta)\n\n**Code**\n\n``` ts\n// @strictNullChecks: true\n\nfunction on(event: string, callback: () => void): { destroy(): void; } {\n    return {\n        destroy() {\n            /* nothing */\n        }\n    };\n}\n\nconst handle = on('example', () => {\n    handle.destroy(); // error TS2454: Variable 'handle' is used before being assigned.\n});\n```\n\n**Expected behavior:**\n\nCompile without errors.\n\n**Actual behavior:** \n\nError that `handle` is being used before it is assigned.\n\nIt seems to be overly aggressive behaviour which means using block scoped variables in a callback is causing usability issues.  Shouldn't flow control assumed that functions would be resolved after the function returns a value?\n\nSeems to be a little bit related to #9382, but in this case, the type is resolvable (and `handle.destroy()` provides insight.  I also noticed that in VSCode, while other compiler errors are displaying, this one isn't getting flagged in the IDE (that may still just be my setup though).\n","author":{"url":"https://github.com/kitsonk","@type":"Person","name":"kitsonk"},"datePublished":"2016-07-15T11:49:20Z","url":"https://github.com/microsoft/TypeScript/issues/9757"}

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:16de299e-dae9-2059-cbc0-3fb3d64d02c1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCBF0:D0E46:A91B52:E0D840:6B00EA7F
html-safe-noncee92136ee8dca0a741b3cb86c32e3bd86216fbb5f67dd203e3dc646e25d896bc9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkYwOkQwRTQ2OkE5MUI1MjpFMEQ4NDA6NkIwMEVBN0YiLCJ2aXNpdG9yX2lkIjoiNTcyNjUxMzU0ODYyMDc4NjMwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac10442874ec531b374d7c87e5efa0315342e7ac3edd12c8c8702d175bfcea7e43
hovercard-subject-tagissue:165770401
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/9757/issue_layout
twitter:imagehttps://opengraph.githubassets.com/988d7375f55df5a8e064a57e31f3990ea6615f399731e91094b19f82beb588f2/microsoft/TypeScript/issues/9757
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/988d7375f55df5a8e064a57e31f3990ea6615f399731e91094b19f82beb588f2/microsoft/TypeScript/issues/9757
og:image:altTypeScript Version: 2.0.0 (beta) Code // @strictNullChecks: true function on(event: string, callback: () => void): { destroy(): void; } { return { destroy() { /* nothing */ } }; } const handle = on...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekitsonk
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/9757#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F9757
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%2F9757
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/9757
Reloadhttps://github.com/microsoft/TypeScript/issues/9757
Reloadhttps://github.com/microsoft/TypeScript/issues/9757
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/9757
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/9757
Aggressive "used before assigned" with strictNullCheckshttps://github.com/microsoft/TypeScript/issues/9757#top
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.0.3https://github.com/microsoft/TypeScript/milestone/27
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 15, 2016https://github.com/microsoft/TypeScript/issues/9757#issue-165770401
#9382https://github.com/microsoft/TypeScript/issues/9382
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 15, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233010923
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 15, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233051818
Anthony Gubler (@agubler)https://github.com/agubler
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Jul 15, 2016https://github.com/microsoft/TypeScript/issues/9757#event-724944582
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 15, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233080014
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 16, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233111455
https://github.com/Arnavion
Arnav Singh (Arnavion)https://github.com/Arnavion
on Jul 16, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233115761
https://github.com/sledorze
Stéphane Le Dorze (sledorze)https://github.com/sledorze
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233159864
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233169729
Stéphane Le Dorze (@sledorze)https://github.com/sledorze
#16https://github.com/microsoft/TypeScript/issues/16
https://github.com/sledorze
Stéphane Le Dorze (sledorze)https://github.com/sledorze
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233192633
Kitson Kelly (@kitsonk)https://github.com/kitsonk
https://github.com/Artazor
Anatoly Ressin (Artazor)https://github.com/Artazor
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233197440
Kitson Kelly (@kitsonk)https://github.com/kitsonk
https://github.com/Artazor
Anatoly Ressin (Artazor)https://github.com/Artazor
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233202071
https://github.com/Artazor
Anatoly Ressin (Artazor)https://github.com/Artazor
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233202413
Benjamin Gruenbaum (@benjamingr)https://github.com/benjamingr
spion (@spion)https://github.com/spion
https://github.com/yortus
Troy Gerwien (yortus)https://github.com/yortus
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233215035
Anatoly Ressin (@Artazor)https://github.com/Artazor
Improve control flow analysis in function expressions #8849https://github.com/microsoft/TypeScript/pull/8849
Discriminated union types lose their narrowed type inside nested function scopes #9258https://github.com/microsoft/TypeScript/issues/9258
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233218254
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233231759
Stéphane Le Dorze (@sledorze)https://github.com/sledorze
https://github.com/novemberborn
Mark Wubben (novemberborn)https://github.com/novemberborn
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233272358
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233353866
Kitson Kelly (@kitsonk)https://github.com/kitsonk
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Jul 18, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-233357813
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/unional
Homa Wong (unional)https://github.com/unional
on Aug 3, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-237327176
#9382 (comment)https://github.com/microsoft/TypeScript/issues/9382#issuecomment-230790930
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.0.3https://github.com/microsoft/TypeScript/milestone/27
on Sep 29, 2016https://github.com/microsoft/TypeScript/issues/9757#event-806415823
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on Sep 29, 2016https://github.com/microsoft/TypeScript/issues/9757#event-806415853
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 29, 2016https://github.com/microsoft/TypeScript/issues/9757#issuecomment-250363195
#10815https://github.com/microsoft/TypeScript/pull/10815
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 29, 2016https://github.com/microsoft/TypeScript/issues/9757#event-806415997
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/9757#event-1689842709
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/9757
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/9757
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.0.3https://github.com/microsoft/TypeScript/milestone/27
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.