René's URL Explorer Experiment


Title: [5.3] Type narrowing regression with property comparison to boolean false · Issue #56482 · microsoft/TypeScript · GitHub

Open Graph Title: [5.3] Type narrowing regression with property comparison to boolean false · Issue #56482 · microsoft/TypeScript

X Title: [5.3] Type narrowing regression with property comparison to boolean false · Issue #56482 · microsoft/TypeScript

Description: 🔎 Search Terms narrowing, strict equals, property access, boolean false, undefined 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 This also happens in the nightly ⏯ Playground Link https://www.typescriptlang...

Open Graph Description: 🔎 Search Terms narrowing, strict equals, property access, boolean false, undefined 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 This also happens in the nightly ⏯ Pl...

X Description: 🔎 Search Terms narrowing, strict equals, property access, boolean false, undefined 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 This also happens in the nightly ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[5.3] Type narrowing regression with property comparison to boolean false","articleBody":"### 🔎 Search Terms\r\n\r\nnarrowing, strict equals, property access, boolean false, undefined\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 5.2 and 5.3\r\n- This also happens in the nightly\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play?ts=5.3.1-rc#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnIBGcUAXEZgDYRwi4C+uuC6IAzmMgOYRgZYBeZAAoAlOX7IAPsgCuIACYQYoCAuQCAfDnzIovWVBDIAsnDAALAHRRaC9AFsxybQAYrAVmQB+HERLk8JRsKPTI5PJKKiBqDEws7JwwmBrcvPxiuMAwIsno3lbEUBoCQkEhojoECWzo1FaU6FzCeaJxuAD0HcgAAmBsALQQAB4ADhAIYENQUOjFA8h5yMBsyKPobGzAhJQAnnKKyqoKzKy19Y3NeYUkbUA\r\n\r\n### 💻 Code\r\n\r\n```ts\r\ninterface Foo {\r\n  bar: boolean\r\n}\r\n\r\nconst getFoo = (): Foo | undefined => {\r\n  return Math.random() > 0.5 ? { bar: false } : undefined\r\n}\r\n\r\nconst foo = getFoo()\r\nif (foo?.bar === false) {\r\n  console.log(foo)\r\n}\r\n\r\n// @ts-expect-error - foo is possibly undefined\r\nconsole.log(foo.bar)\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\nIn line 13 and following, `foo` is incorrectly narrowed to just `Foo` (whereas it was previously `Foo | undefined`), although we learned nothing about it from the preceding `if` as that did not influence control flow.\r\n\r\n```\r\nUnused '@ts-expect-error' directive.(2578)\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nTS should report an error when accessing `foo.bar` as `foo` can potentially be undefined.\r\n\r\n### Additional information about the issue\r\n\r\nI originally discovered this issue in JSX with a snippet similar to:\r\n\r\n```tsx\r\nfunction Component () {\r\n  const foo = getFoo()\r\n  return (\r\n    \u003cdiv>\r\n      {foo?.bar === false && 'foo'}\r\n      {foo.bar ? 'true' : 'false'}\r\n    \u003c/div>\r\n  )\r\n}\r\n```\r\n\r\nThere as well, the access `foo.bar` is allowed due to the preceding check, although they are completely separate.\r\n\r\nNote that changing it to `=== true` or removing the checks entirely fixes the problem.","author":{"url":"https://github.com/meyfa","@type":"Person","name":"meyfa"},"datePublished":"2023-11-21T13:50:36Z","url":"https://github.com/microsoft/TypeScript/issues/56482"}

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:c80828cc-482b-663c-4e08-bdf0ccbf4e3d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB6FC:3CBB3E:1B79EB0:2300A1A:6B01984F
html-safe-noncec5fab9d887995f329cfd3fe14fae20c8cde7561731bbf5b9f1b869ad4e0e44a2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkZDOjNDQkIzRToxQjc5RUIwOjIzMDBBMUE6NkIwMTk4NEYiLCJ2aXNpdG9yX2lkIjoiOTA2MDk4MDA5ODI4MjM5NTcyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1b3834cd774d7792e0920f220508b0179f98ec0afbce812e204869f7ea5d84eb
hovercard-subject-tagissue:2004334281
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/56482/issue_layout
twitter:imagehttps://opengraph.githubassets.com/13215719f09489f32108ca2bb9eb9365023d218dc61ee175587d10f29cb7ff0f/microsoft/TypeScript/issues/56482
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/13215719f09489f32108ca2bb9eb9365023d218dc61ee175587d10f29cb7ff0f/microsoft/TypeScript/issues/56482
og:image:alt🔎 Search Terms narrowing, strict equals, property access, boolean false, undefined 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 This also happens in the nightly ⏯ Pl...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemeyfa
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/56482#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F56482
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%2F56482
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/56482
Reloadhttps://github.com/microsoft/TypeScript/issues/56482
Reloadhttps://github.com/microsoft/TypeScript/issues/56482
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/56482
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/56482
#56504https://github.com/microsoft/TypeScript/pull/56504
[5.3] Type narrowing regression with property comparison to boolean falsehttps://github.com/microsoft/TypeScript/issues/56482#top
#56504https://github.com/microsoft/TypeScript/pull/56504
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Recent RegressionThis is a new regression just found in the last major/minor version of TypeScript.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Recent%20Regression%22
TypeScript 5.3.3https://github.com/microsoft/TypeScript/milestone/195
https://github.com/meyfa
Fabian Meyer (meyfa)https://github.com/meyfa
on Nov 21, 2023https://github.com/microsoft/TypeScript/issues/56482#issue-2004334281
https://www.typescriptlang.org/play?ts=5.3.1-rc#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnIBGcUAXEZgDYRwi4C+uuC6IAzmMgOYRgZYBeZAAoAlOX7IAPsgCuIACYQYoCAuQCAfDnzIovWVBDIAsnDAALAHRRaC9AFsxybQAYrAVmQB+HERLk8JRsKPTI5PJKKiBqDEws7JwwmBrcvPxiuMAwIsno3lbEUBoCQkEhojoECWzo1FaU6FzCeaJxuAD0HcgAAmBsALQQAB4ADhAIYENQUOjFA8h5yMBsyKPobGzAhJQAnnKKyqoKzKy19Y3NeYUkbUAhttps://www.typescriptlang.org/play?ts=5.3.1-rc#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnIBGcUAXEZgDYRwi4C+uuC6IAzmMgOYRgZYBeZAAoAlOX7IAPsgCuIACYQYoCAuQCAfDnzIovWVBDIAsnDAALAHRRaC9AFsxybQAYrAVmQB+HERLk8JRsKPTI5PJKKiBqDEws7JwwmBrcvPxiuMAwIsno3lbEUBoCQkEhojoECWzo1FaU6FzCeaJxuAD0HcgAAmBsALQQAB4ADhAIYENQUOjFA8h5yMBsyKPobGzAhJQAnnKKyqoKzKy19Y3NeYUkbUA
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Recent RegressionThis is a new regression just found in the last major/minor version of TypeScript.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Recent%20Regression%22
on Nov 21, 2023https://github.com/microsoft/TypeScript/issues/56482#event-11024843368
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Nov 21, 2023https://github.com/microsoft/TypeScript/issues/56482#issuecomment-1821389699
#53714https://github.com/microsoft/TypeScript/pull/53714
https://github.com/akwodkiewicz
Andrzej Wódkiewicz (akwodkiewicz)https://github.com/akwodkiewicz
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#issuecomment-1822816913
https://www.typescriptlang.org/play?ts=5.3.2#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgeTBgQiQGc4BvAKDjrkwH4AuOAIwggBthMkBuWvTYt2nHn0EBfatXQBXJNmKk46Tm0xQAFBCIlyowivIBKKkLoB6K3AACMMgFpQYYMpdQo0OAHI9JmS+iBSQZGQIbFwAnn6KACbA6MjA8b6WiOhwuvqkZIwAdJhwALxlaphcZHgAPjVwAQZkBWzmNPRwMlJAAhttps://www.typescriptlang.org/play?ts=5.3.2#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgeTBgQiQGc4BvAKDjrkwH4AuOAIwggBthMkBuWvTYt2nHn0EBfatXQBXJNmKk46Tm0xQAFBCIlyowivIBKKkLoB6K3AACMMgFpQYYMpdQo0OAHI9JmS+iBSQZGQIbFwAnn6KACbA6MjA8b6WiOhwuvqkZIwAdJhwALxlaphcZHgAPjVwAQZkBWzmNPRwMlJAA
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#issuecomment-1823261683
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#issuecomment-1823264943
Jake Bailey (jakebailey)https://github.com/jakebailey
TypeScript 5.3.3https://github.com/microsoft/TypeScript/milestone/195
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#event-11039832976
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#event-11039834591
Jake Bailey (jakebailey)https://github.com/jakebailey
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#56504https://github.com/microsoft/TypeScript/pull/56504
on Nov 22, 2023https://github.com/microsoft/TypeScript/issues/56482#event-11040182944
https://github.com/TrippTrapp84
TrippTrapp84https://github.com/TrippTrapp84
on Sep 30, 2024https://github.com/microsoft/TypeScript/issues/56482#issuecomment-2383308426
https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEkoGdnwILwN4CgCQAksugBQCUAXPAC4AWAlmoxgNw4C+OOoSciA9gDtk1eAAco1aiBiCqmAD7wAroNAAzeoJDA261WGr0h8KGLEQAngAVJ02eWz566+CQlSZggPwA6IqRk8AC8ofDqUBDIIEG4eHge9oJs8QD0qfAAet74eHDUyrIpnAl2XinpWTnsQAhttps://www.typescriptlang.org/play/#code/CYUwxgNghgTiAEkoGdnwILwN4CgCQAksugBQCUAXPAC4AWAlmoxgNw4C+OOoSciA9gDtk1eAAco1aiBiCqmAD7wAroNAAzeoJDA261WGr0h8KGLEQAngAVJ02eWz566+CQlSZggPwA6IqRk8AC8ofDqUBDIIEG4eHge9oJs8QD0qfAAet74eHDUyrIpnAl2XinpWTnsQA
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Sep 30, 2024https://github.com/microsoft/TypeScript/issues/56482#issuecomment-2383490850
microsofthttps://github.com/microsoft
on Oct 22, 2025https://github.com/microsoft/TypeScript/issues/56482#event-20419618780
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/56482
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/56482
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Recent RegressionThis is a new regression just found in the last major/minor version of TypeScript.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Recent%20Regression%22
TypeScript 5.3.3https://github.com/microsoft/TypeScript/milestone/195
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.