René's URL Explorer Experiment


Title: Breaking change: Use of 'void' in control flow constructs is now disallowed · Issue #26262 · microsoft/TypeScript · GitHub

Open Graph Title: Breaking change: Use of 'void' in control flow constructs is now disallowed · Issue #26262 · microsoft/TypeScript

X Title: Breaking change: Use of 'void' in control flow constructs is now disallowed · Issue #26262 · microsoft/TypeScript

Description: TypeScript Version: 3.1 Search Terms: boolean void truthy falsy if while do for not An expression of type 'void' cannot be tested for truthiness Code Consider this code: function existsAndIsCool(fileName: string) { fs.exists(fileName, ex...

Open Graph Description: TypeScript Version: 3.1 Search Terms: boolean void truthy falsy if while do for not An expression of type 'void' cannot be tested for truthiness Code Consider this code: function existsAndIsCool(fi...

X Description: TypeScript Version: 3.1 Search Terms: boolean void truthy falsy if while do for not An expression of type 'void' cannot be tested for truthiness Code Consider this code: function existsAndI...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Breaking change: Use of 'void' in control flow constructs is now disallowed","articleBody":"**TypeScript Version:**  3.1\r\n\r\n**Search Terms:** boolean void truthy falsy if while do for not\r\n\r\nAn expression of type 'void' cannot be tested for truthiness\r\n\r\n**Code**\r\n\r\nConsider this code:\r\n```ts\r\nfunction existsAndIsCool(fileName: string) {\r\n  fs.exists(fileName, exists => {\r\n    return exists && isCool(fileName);\r\n  });\r\n}\r\n\r\nif (existsAndIsCool(\"myFile\")) {\r\n  console.log(\"Cool!\");\r\n} else {\r\n  console.log(\"Not cool :(\");\r\n}\r\n```\r\n\r\n**Expected behavior:** The \"Cool!\" branch is actually unreachable because `existsAndIsCool` returns `void`, not `boolean`. I should have been warned about this at some point.\r\n\r\n**Actual behavior:** No error, never cool 😢 \r\n\r\n**Playground Link:** [Link](http://www.typescriptlang.org/play/#src=declare%20const%20fs%3A%20%7B%20exists%3A%20(fileName%3A%20string%2C%20cb%3A%20(exists%3A%20boolean)%20%3D%3E%20void)%20%3D%3E%20void%3B%20%7D%0D%0Adeclare%20function%20isCool(fileName%3A%20string)%3A%20boolean%3B%0D%0A%0D%0Afunction%20existsAndIsCool(fileName%3A%20string)%20%7B%0D%0A%20%20fs.exists(fileName%2C%20exists%20%3D%3E%20%7B%0D%0A%20%20%20%20return%20exists%20%26%26%20isCool(fileName)%3B%0D%0A%20%20%7D)%3B%0D%0A%7D%0D%0A%0D%0Aif%20(existsAndIsCool(%22myFile%22))%20%7B%0D%0A%20%20console.log(%22Cool!%22)%3B%0D%0A%7D%20else%20%7B%0D%0A%20%20console.log(%22Not%20cool%20%3A(%22)%3B%0D%0A%7D))\r\n\r\n**Related Issues:** \r\nPR #26234 \r\n#7256\r\n#10942\r\n#7306\r\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2018-08-07T15:47:13Z","url":"https://github.com/microsoft/TypeScript/issues/26262"}

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:612a5b57-5a9e-c304-a798-1fd34781af22
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDA56:26BC2B:50EC0C:71EC50:6B0445C0
html-safe-nonceccf43fd2024c3dbbdae0f47d0497cd42115f27193fa847c9de7fd854571640b6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTU2OjI2QkMyQjo1MEVDMEM6NzFFQzUwOjZCMDQ0NUMwIiwidmlzaXRvcl9pZCI6IjMyNTM0MTU0MjkwNDUyNDEyODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac845ede25933af885e3c9d5b259013a5e31d35db2395d20f0e58a60a19dbc974f
hovercard-subject-tagissue:348380741
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/26262/issue_layout
twitter:imagehttps://opengraph.githubassets.com/64f69d5f7ee0826ad7014158165fb7775bd6660b8151406d4273f2b8b2a05086/microsoft/TypeScript/issues/26262
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/64f69d5f7ee0826ad7014158165fb7775bd6660b8151406d4273f2b8b2a05086/microsoft/TypeScript/issues/26262
og:image:altTypeScript Version: 3.1 Search Terms: boolean void truthy falsy if while do for not An expression of type 'void' cannot be tested for truthiness Code Consider this code: function existsAndIsCool(fi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameRyanCavanaugh
hostnamegithub.com
expected-hostnamegithub.com
Noned4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46
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
release9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/26262#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F26262
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%2F26262
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/26262
Reloadhttps://github.com/microsoft/TypeScript/issues/26262
Reloadhttps://github.com/microsoft/TypeScript/issues/26262
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests320 (320)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/26262
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/26262
Breaking change: Use of 'void' in control flow constructs is now disallowedhttps://github.com/microsoft/TypeScript/issues/26262#top
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Aug 7, 2018https://github.com/microsoft/TypeScript/issues/26262#issue-348380741
Linkhttp://www.typescriptlang.org/play/#src=declare%20const%20fs%3A%20%7B%20exists%3A%20(fileName%3A%20string%2C%20cb%3A%20(exists%3A%20boolean)%20%3D%3E%20void)%20%3D%3E%20void%3B%20%7D%0D%0Adeclare%20function%20isCool(fileName%3A%20string)%3A%20boolean%3B%0D%0A%0D%0Afunction%20existsAndIsCool(fileName%3A%20string)%20%7B%0D%0A%20%20fs.exists(fileName%2C%20exists%20%3D%3E%20%7B%0D%0A%20%20%20%20return%20exists%20%26%26%20isCool(fileName)%3B%0D%0A%20%20%7D)%3B%0D%0A%7D%0D%0A%0D%0Aif%20(existsAndIsCool(%22myFile%22))%20%7B%0D%0A%20%20console.log(%22Cool!%22)%3B%0D%0A%7D%20else%20%7B%0D%0A%20%20console.log(%22Not%20cool%20%3A(%22)%3B%0D%0A%7D)
#26234https://github.com/microsoft/TypeScript/pull/26234
#7256https://github.com/microsoft/TypeScript/issues/7256
#10942https://github.com/microsoft/TypeScript/issues/10942
#7306https://github.com/microsoft/TypeScript/issues/7306
Nexthttps://github.com/microsoft/TypeScript/issues/26262?timeline_page=1
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
on Aug 7, 2018https://github.com/microsoft/TypeScript/issues/26262#event-1775640679
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
on Aug 7, 2018https://github.com/microsoft/TypeScript/issues/26262#event-1775640688
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Aug 7, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-411104836
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 8, 2018https://github.com/microsoft/TypeScript/issues/26262#event-1778806468
https://github.com/fox1t
Maksim Sinik (fox1t)https://github.com/fox1t
on Oct 1, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-425943581
"Declaring variables of type void is not useful because you can only assign undefined or null to them"https://www.typescriptlang.org/docs/handbook/basic-types.html
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 1, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-425976165
Maksim Sinik (@fox1t)https://github.com/fox1t
https://stackoverflow.com/questions/41750390/what-does-all-legal-javascript-is-legal-typescript-meanhttps://stackoverflow.com/questions/41750390/what-does-all-legal-javascript-is-legal-typescript-mean
https://github.com/fox1t
Maksim Sinik (fox1t)https://github.com/fox1t
on Oct 1, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-425984604
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/kitwestneat
Kit Westneat (kitwestneat)https://github.com/kitwestneat
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427052390
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427081176
https://github.com/kitwestneat
Kit Westneat (kitwestneat)https://github.com/kitwestneat
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427087261
https://github.com/fox1t
Maksim Sinik (fox1t)https://github.com/fox1t
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427089185
Kit Westneat (@kitwestneat)https://github.com/kitwestneat
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427090023
#26262 (comment)https://github.com/microsoft/TypeScript/issues/26262#issuecomment-425976165
https://github.com/kitwestneat
Kit Westneat (kitwestneat)https://github.com/kitwestneat
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427090619
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427091753
https://github.com/fox1t
Maksim Sinik (fox1t)https://github.com/fox1t
on Oct 4, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427099147
https://github.com/fox1t
Maksim Sinik (fox1t)https://github.com/fox1t
on Oct 5, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-427280939
"Declaring variables of type void is not useful because you can only assign undefined or null to them"https://www.typescriptlang.org/docs/handbook/basic-types.html
https://github.com/earshinov
earshinovhttps://github.com/earshinov
on Oct 19, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-431406596
Maksim Sinik (@fox1t)https://github.com/fox1t
https://user-images.githubusercontent.com/52021/47228675-7c7b9e00-d3ce-11e8-951d-7ae1be679b42.png
https://github.com/earshinov/typescript-type-compatibility-tablehttps://github.com/earshinov/typescript-type-compatibility-table
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 19, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-431423841
earshinovhttps://github.com/earshinov
https://github.com/connorjclark
Connor Clark (connorjclark)https://github.com/connorjclark
on Oct 19, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-431431647
https://user-images.githubusercontent.com/4071474/47233111-88437200-d386-11e8-875c-99b406d90a6d.png
https://github.com/igpeev
zaggi (igpeev)https://github.com/igpeev
on Dec 9, 2018https://github.com/microsoft/TypeScript/issues/26262#issuecomment-445542762
https://github.com/ackvf
Qwerty (Vítězslav Ackermann Ferko) (ackvf)https://github.com/ackvf
on Feb 20, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-465692237
https://github.com/thscott
thscotthttps://github.com/thscott
on Feb 24, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-466825322
https://github.com/sharno
sharno (sharno)https://github.com/sharno
on Nov 21, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-557296343
https://github.com/weswigham
Wesley Wigham (weswigham)https://github.com/weswigham
on Nov 21, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-557304476
https://github.com/ackvf
Qwerty (Vítězslav Ackermann Ferko) (ackvf)https://github.com/ackvf
on Nov 26, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-558585854
https://github.com/stavalfi
Stav Alfi (stavalfi)https://github.com/stavalfi
on Dec 2, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-560248198
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/ackvf
Qwerty (Vítězslav Ackermann Ferko) (ackvf)https://github.com/ackvf
on Dec 30, 2019https://github.com/microsoft/TypeScript/issues/26262#issuecomment-569646256
Stav Alfi (@stavalfi)https://github.com/stavalfi
yazhougithubhttps://github.com/yazhougithub
on Jul 16, 2021https://github.com/microsoft/TypeScript/issues/26262#event-5028747093
use comma operator instead of || because void type cannot be tested f…https://github.com/yazhougithub/frontendofxian/commit/4eff6db7800e8ca0f992c42b86c4b09437be5016
4eff6dbhttps://github.com/yazhougithub/frontendofxian/commit/4eff6db7800e8ca0f992c42b86c4b09437be5016
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/26262
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/26262
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
TypeScript 3.1https://github.com/microsoft/TypeScript/milestone/74
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.