René's URL Explorer Experiment


Title: [TS 5.4.0-beta] `instaceof` narrowing impacted by prototype property · Issue #57397 · microsoft/TypeScript · GitHub

Open Graph Title: [TS 5.4.0-beta] `instaceof` narrowing impacted by prototype property · Issue #57397 · microsoft/TypeScript

X Title: [TS 5.4.0-beta] `instaceof` narrowing impacted by prototype property · Issue #57397 · microsoft/TypeScript

Description: 🔎 Search Terms instanceof, narrowing, prototype 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta. This changed on 5.4.0-dev.20231130 (commits) ⏯ Playground Link https://www.typescriptlang.org/play?tar...

Open Graph Description: 🔎 Search Terms instanceof, narrowing, prototype 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta. This changed on 5.4.0-dev.20231130 (commits) ⏯ Playground Link...

X Description: 🔎 Search Terms instanceof, narrowing, prototype 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta. This changed on 5.4.0-dev.20231130 (commits) ⏯ Playground ...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[TS 5.4.0-beta] `instaceof` narrowing impacted by prototype property","articleBody":"### 🔎 Search Terms\r\n\r\ninstanceof, narrowing, prototype\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 5.3.3 and 5.4.0-beta. \r\n- This changed on 5.4.0-dev.20231130 ([commits](https://github.com/microsoft/TypeScript/compare/2869579b2cad770ae20617e4148741c2ce35ffdc...7216ee0bb821b4b565d54c52dcbf788a3fdf7062))\r\n\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play?target=99&ts=5.4.0-dev.20231130#code/CYUwxgNghgTiAEkoGdnwOoEtgHMQBd4BvAKHnNGXxgHsBPACgEoAueANxuwG4SBfEiVBI4iGgDsqGbHnwBhCVRgBXMPhow2pcuXEgA7szZZcBXgKHhoosIsIBZEOOUnZc6Ki1kdew62LeOjqYyI7OADIh+GwARjQ0ECBQ4rxBfPAAZNKm+Kk6AA606vh0+SBsJWU0AGbZbnYqahrc8AD0rfAAPAC03fBwALY07JjiOPD4ABYh8FCc2GggMLQw-LwklQhhLjIE8AC88ACSkvjJYCAAKqUgnZs18NuuBO4oyAB868LWCLanj04djkKjcHk9dvIPGgstofAYjADnM98GtBO10RjMVjsTjcXj0YJEoQ-vgnNFEUDZPAAD7wZTiUDVUYgYC8b6wX52DjGCHrTC1BjseCjKjnEBgwHIpgBILkElkg4cFrtLq9eC+eBLFbC8TwACsADoACwGgAM3RiBCg-EEIAAHvkNIQiAIgA\r\n\r\n### 💻 Code\r\n\r\n(reduced down from large repo as best I could)\r\n\r\n```ts\r\ndeclare class Widget {\r\n   destroy(): void;\r\n}\r\n\r\ndeclare const WidgetConstructor: {\r\n    new(): Widget;\r\n}\r\n\r\ndeclare const MenuWidgetClass: {\r\n    new(): {\r\n        isMenuList: boolean;\r\n    } & Widget;\r\n    prototype: typeof WidgetConstructor; // \u003c-- removing this avoids error\r\n};\r\n\r\ntype MenuWidget = InstanceType\u003ctypeof MenuWidgetClass>;\r\n\r\ndeclare const MenuWidget: typeof MenuWidgetClass & {\r\n    new(): MenuWidget\r\n};\r\n\r\n/////////////////////////////////////////////////////////\r\n\r\nlet content: MenuWidget | undefined;\r\ndeclare const v: Widget;\r\n\r\nif (v instanceof MenuWidget) {\r\n      content = v; // \u003c-- new error in 5.4.0-beta\r\n}\r\n```\r\n\r\n\r\n###  New behavior\r\n\r\nTypeScript `5.4.0-beta` appears to be consulting the `.prototype` property of the type in a way that it wasn't before resulting in the `instanceof` narrowing to narrow to the base class.\r\n\r\n###  Previous behavior\r\n\r\nThe code in `5.3.3` was expecting the `instanceof` to narrow to the return type of the function being consulted.\r\n\r\n### Additional information about the issue\r\n\r\nNote: this is more of a change report than a bug report, as I don't think this was announced in the 5.4.0-beta breaking changes. I suspect the change is an improvement and is catching a potential issue that was previously unsafe.","author":{"url":"https://github.com/acutmore","@type":"Person","name":"acutmore"},"datePublished":"2024-02-13T15:39:03Z","url":"https://github.com/microsoft/TypeScript/issues/57397"}

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:422f871a-519e-e888-bd4d-3be125871c3d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE724:2AE08B:12050A:180F5D:6B04E2B9
html-safe-nonce92711cf04bde6f2a5c4a16d17026367625046ac1342b393a1489877c51fdb2ed
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzI0OjJBRTA4QjoxMjA1MEE6MTgwRjVEOjZCMDRFMkI5IiwidmlzaXRvcl9pZCI6Ijg0NzQyMDQ2NTEzMDUzNjIxMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9fe948fe8f1cc13c3c730492f3a911547f0b3f7e5f7663746e18fbd341adea4e
hovercard-subject-tagissue:2132606546
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/57397/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b3e867cf9b5e25373756bb7f3f3eddfddb054bd2bd41bfc2efb543f5d5c8432/microsoft/TypeScript/issues/57397
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b3e867cf9b5e25373756bb7f3f3eddfddb054bd2bd41bfc2efb543f5d5c8432/microsoft/TypeScript/issues/57397
og:image:alt🔎 Search Terms instanceof, narrowing, prototype 🕗 Version & Regression Information This changed between versions 5.3.3 and 5.4.0-beta. This changed on 5.4.0-dev.20231130 (commits) ⏯ Playground Link...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameacutmore
hostnamegithub.com
expected-hostnamegithub.com
None970f03f35f02bb123d2b6f1884601d89a570dc02e5ef9612b1b6ca5c033b1796
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
releaseebcec4199c8521b643c068ef118a1ba9a43b678a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/57397#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F57397
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%2F57397
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/57397
Reloadhttps://github.com/microsoft/TypeScript/issues/57397
Reloadhttps://github.com/microsoft/TypeScript/issues/57397
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests318 (318)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/57397
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/57397
[TS 5.4.0-beta] instaceof narrowing impacted by prototype propertyhttps://github.com/microsoft/TypeScript/issues/57397#top
Not a Defecthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Not%20a%20Defect%22
https://github.com/acutmore
Ashley Claymore (acutmore)https://github.com/acutmore
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issue-2132606546
commitshttps://github.com/microsoft/TypeScript/compare/2869579b2cad770ae20617e4148741c2ce35ffdc...7216ee0bb821b4b565d54c52dcbf788a3fdf7062
https://www.typescriptlang.org/play?target=99&ts=5.4.0-dev.20231130#code/CYUwxgNghgTiAEkoGdnwOoEtgHMQBd4BvAKHnNGXxgHsBPACgEoAueANxuwG4SBfEiVBI4iGgDsqGbHnwBhCVRgBXMPhow2pcuXEgA7szZZcBXgKHhoosIsIBZEOOUnZc6Ki1kdew62LeOjqYyI7OADIh+GwARjQ0ECBQ4rxBfPAAZNKm+Kk6AA606vh0+SBsJWU0AGbZbnYqahrc8AD0rfAAPAC03fBwALY07JjiOPD4ABYh8FCc2GggMLQw-LwklQhhLjIE8AC88ACSkvjJYCAAKqUgnZs18NuuBO4oyAB868LWCLanj04djkKjcHk9dvIPGgstofAYjADnM98GtBO10RjMVjsTjcXj0YJEoQ-vgnNFEUDZPAAD7wZTiUDVUYgYC8b6wX52DjGCHrTC1BjseCjKjnEBgwHIpgBILkElkg4cFrtLq9eC+eBLFbC8TwACsADoACwGgAM3RiBCg-EEIAAHvkNIQiAIgAhttps://www.typescriptlang.org/play?target=99&ts=5.4.0-dev.20231130#code/CYUwxgNghgTiAEkoGdnwOoEtgHMQBd4BvAKHnNGXxgHsBPACgEoAueANxuwG4SBfEiVBI4iGgDsqGbHnwBhCVRgBXMPhow2pcuXEgA7szZZcBXgKHhoosIsIBZEOOUnZc6Ki1kdew62LeOjqYyI7OADIh+GwARjQ0ECBQ4rxBfPAAZNKm+Kk6AA606vh0+SBsJWU0AGbZbnYqahrc8AD0rfAAPAC03fBwALY07JjiOPD4ABYh8FCc2GggMLQw-LwklQhhLjIE8AC88ACSkvjJYCAAKqUgnZs18NuuBO4oyAB868LWCLanj04djkKjcHk9dvIPGgstofAYjADnM98GtBO10RjMVjsTjcXj0YJEoQ-vgnNFEUDZPAAD7wZTiUDVUYgYC8b6wX52DjGCHrTC1BjseCjKjnEBgwHIpgBILkElkg4cFrtLq9eC+eBLFbC8TwACsADoACwGgAM3RiBCg-EEIAAHvkNIQiAIgA
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942001094
commitshttps://github.com/microsoft/TypeScript/commits/7216ee0bb821b4b565d54c52dcbf788a3fdf7062/?since=2023-11-29&until=2023-11-29
herehttps://github.com/microsoft/TypeScript/compare/2869579b2cad770ae20617e4148741c2ce35ffdc...7216ee0bb821b4b565d54c52dcbf788a3fdf7062
this PRhttps://github.com/microsoft/TypeScript/pull/54753
https://github.com/acutmore
Ashley Claymore (acutmore)https://github.com/acutmore
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942028723
herehttps://github.com/microsoft/TypeScript/compare/2869579b2cad770ae20617e4148741c2ce35ffdc...7216ee0bb821b4b565d54c52dcbf788a3fdf7062
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942103454
every-tshttps://github.com/jakebailey/every-ts
https://github.com/acutmore
Ashley Claymore (acutmore)https://github.com/acutmore
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942109708
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942111197
https://github.com/acutmore
Ashley Claymore (acutmore)https://github.com/acutmore
on Feb 13, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1942127162
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Feb 14, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1944434777
#54753https://github.com/microsoft/TypeScript/pull/54753
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Feb 15, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1945672820
#54753https://github.com/microsoft/TypeScript/pull/54753
https://github.com/acutmore
Ashley Claymore (acutmore)https://github.com/acutmore
on Feb 15, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1945944819
Mateusz Burzyński (@Andarist)https://github.com/Andarist
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Not a Defecthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Not%20a%20Defect%22
on Feb 15, 2024https://github.com/microsoft/TypeScript/issues/57397#event-11818302318
https://github.com/typescript-bot
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
on Feb 18, 2024https://github.com/microsoft/TypeScript/issues/57397#issuecomment-1950718224
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
not plannedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Feb 18, 2024https://github.com/microsoft/TypeScript/issues/57397#event-11837573035
microsofthttps://github.com/microsoft
on Oct 22, 2025https://github.com/microsoft/TypeScript/issues/57397#event-20419639449
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/57397
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/57397
Not a Defecthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Not%20a%20Defect%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

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.