René's URL Explorer Experiment


Title: Possible to narrow type of object literal property with strictNullChecks? · Issue #20219 · microsoft/TypeScript · GitHub

Open Graph Title: Possible to narrow type of object literal property with strictNullChecks? · Issue #20219 · microsoft/TypeScript

X Title: Possible to narrow type of object literal property with strictNullChecks? · Issue #20219 · microsoft/TypeScript

Description: TypeScript Version: Current playground (2.6?) Code type Foo = { bar?: number[]; } let f1: Foo = {}; f1.bar = []; f1.bar.push(0); let f2: Foo = { bar: [] }; f2.bar.push(0); Expected behavior: Both references to .bar compile successfully. ...

Open Graph Description: TypeScript Version: Current playground (2.6?) Code type Foo = { bar?: number[]; } let f1: Foo = {}; f1.bar = []; f1.bar.push(0); let f2: Foo = { bar: [] }; f2.bar.push(0); Expected behavior: Both r...

X Description: TypeScript Version: Current playground (2.6?) Code type Foo = { bar?: number[]; } let f1: Foo = {}; f1.bar = []; f1.bar.push(0); let f2: Foo = { bar: [] }; f2.bar.push(0); Expected behavior: Both r...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible to narrow type of object literal property with strictNullChecks?","articleBody":"**TypeScript Version:**  Current playground (2.6?)\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Foo = {\r\n  bar?: number[];\r\n}\r\n\r\nlet f1: Foo = {};\r\nf1.bar = [];\r\nf1.bar.push(0);\r\n\r\nlet f2: Foo = { bar: [] };\r\nf2.bar.push(0);\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nBoth references to `.bar` compile successfully.\r\n\r\n**Actual behavior:**\r\n\r\nSecond reference (`f2.bar.push(0)`) fails with \"object is possibly undefined\" -- the type of `f2.bar` is still treated as `number[] | undefined` even though it obviously can't be undefined.\r\n\r\n----\r\n\r\nThis might not be an actual *bug* as such but whatever magic allows the compiler to narrow the type of `f1.bar` after assigning to it, should also be able to narrow the type when it was assigned in the literal.","author":{"url":"https://github.com/thw0rted","@type":"Person","name":"thw0rted"},"datePublished":"2017-11-22T10:57:39Z","url":"https://github.com/microsoft/TypeScript/issues/20219"}

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:07bcfe19-2b40-1407-2c49-ad019e10411a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCFC8:38C5CF:107A40B:151C04E:6B01004D
html-safe-nonce9c2698ec8df0aac1818df6a6b13fe09681fbd01654cf8af2e1b10ea59fe64c87
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkM4OjM4QzVDRjoxMDdBNDBCOjE1MUMwNEU6NkIwMTAwNEQiLCJ2aXNpdG9yX2lkIjoiODQ0NDM2MjQxMTA3ODY0Nzg4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac948c684de60370c42b07543c8743d05e7acb8b4bf891eaa3453e6ad3904233ce
hovercard-subject-tagissue:276025466
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/20219/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3e2847a5a5fe7f19548b705e7c0e1eb5cebe0c3b20baf7e826f12fc1ab437a0b/microsoft/TypeScript/issues/20219
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3e2847a5a5fe7f19548b705e7c0e1eb5cebe0c3b20baf7e826f12fc1ab437a0b/microsoft/TypeScript/issues/20219
og:image:altTypeScript Version: Current playground (2.6?) Code type Foo = { bar?: number[]; } let f1: Foo = {}; f1.bar = []; f1.bar.push(0); let f2: Foo = { bar: [] }; f2.bar.push(0); Expected behavior: Both r...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamethw0rted
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/20219#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F20219
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%2F20219
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/20219
Reloadhttps://github.com/microsoft/TypeScript/issues/20219
Reloadhttps://github.com/microsoft/TypeScript/issues/20219
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/20219
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/20219
Possible to narrow type of object literal property with strictNullChecks?https://github.com/microsoft/TypeScript/issues/20219#top
https://github.com/sandersn
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/thw0rted
James Bromwell (thw0rted)https://github.com/thw0rted
on Nov 22, 2017https://github.com/microsoft/TypeScript/issues/20219#issue-276025466
Nexthttps://github.com/microsoft/TypeScript/issues/20219?timeline_page=1
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Nov 22, 2017https://github.com/microsoft/TypeScript/issues/20219#event-1354575564
https://github.com/aluanhaddad
Aluan Haddad (aluanhaddad)https://github.com/aluanhaddad
on Dec 4, 2017https://github.com/microsoft/TypeScript/issues/20219#issuecomment-349099204
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Jan 30, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1447541010
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Jan 30, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1447541104
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 2.8https://github.com/microsoft/TypeScript/milestone/61
on Jan 30, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1447541274
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jan 30, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-361433426
Nathan Shively-Sanders (@sandersn)https://github.com/sandersn
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 7, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-363821374
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 7, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-363838771
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 16, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-366308696
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 16, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-366359609
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 20, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-367041402
#22006https://github.com/microsoft/TypeScript/pull/22006
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.8https://github.com/microsoft/TypeScript/milestone/61
TypeScript 2.9https://github.com/microsoft/TypeScript/milestone/67
on Mar 9, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1514236086
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 3.0https://github.com/microsoft/TypeScript/milestone/70
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
on Jul 2, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1712744768
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Aug 24, 2018https://github.com/microsoft/TypeScript/issues/20219#issuecomment-415675591
Nathan Shively-Sanders (@sandersn)https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
TypeScript 3.2https://github.com/microsoft/TypeScript/milestone/77
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1829066108
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on Oct 18, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1912925476
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
TypeScript 3.2https://github.com/microsoft/TypeScript/milestone/77
TypeScript 3.3https://github.com/microsoft/TypeScript/milestone/79
on Oct 30, 2018https://github.com/microsoft/TypeScript/issues/20219#event-1936485796
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
TypeScript 3.3https://github.com/microsoft/TypeScript/milestone/79
TypeScript 3.4.0https://github.com/microsoft/TypeScript/milestone/86
on Jan 16, 2019https://github.com/microsoft/TypeScript/issues/20219#event-2078874021
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
TypeScript 3.4.0https://github.com/microsoft/TypeScript/milestone/86
on Mar 13, 2019https://github.com/microsoft/TypeScript/issues/20219#event-2201688164
https://github.com/DanTup
Danny Tuppeny (DanTup)https://github.com/DanTup
on Oct 8, 2019https://github.com/microsoft/TypeScript/issues/20219#issuecomment-539467527
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Oct 15, 2019https://github.com/microsoft/TypeScript/issues/20219#issuecomment-542437481
Danny Tuppeny (@DanTup)https://github.com/DanTup
https://github.com/DanTup
Danny Tuppeny (DanTup)https://github.com/DanTup
on Oct 16, 2019https://github.com/microsoft/TypeScript/issues/20219#issuecomment-542585157
Nathan Shively-Sanders (@sandersn)https://github.com/sandersn
https://github.com/DanTup
Danny Tuppeny (DanTup)https://github.com/DanTup
on Oct 16, 2019https://github.com/microsoft/TypeScript/issues/20219#issuecomment-542586091
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/20219
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/20219
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%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.