René's URL Explorer Experiment


Title: unique symbol lost on assignment to const despite type assertion · Issue #55901 · microsoft/TypeScript · GitHub

Open Graph Title: unique symbol lost on assignment to const despite type assertion · Issue #55901 · microsoft/TypeScript

X Title: unique symbol lost on assignment to const despite type assertion · Issue #55901 · microsoft/TypeScript

Description: 🔎 Search Terms unique symbol widening 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground Link 💻 Code const u = Symbol(); const a7 = u as typeof u // widened to symbol 🙁 Actual be...

Open Graph Description: 🔎 Search Terms unique symbol widening 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground Link 💻 Code const u = Symbol(); const a7 = u as t...

X Description: 🔎 Search Terms unique symbol widening 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground Link 💻 Code const u = Symbol(); const a7 = u ...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"unique symbol lost on assignment to const despite type assertion ","articleBody":"### 🔎 Search Terms\r\n\r\nunique symbol widening\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is the behavior in every version I tried\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground Link](https://www.typescriptlang.org/play?#code/N4KABBYMYPYHYGcAuYCuYC8YBEBBbA3OJLIigIYCMmaY5CYSAngA4CmMAZrQPQ9hwYKAO4BLACZs4bccQilkdAEw10fAULBjJ02ZDAAbNhQDMqug2bsuvfoJESpMuYeN0ALOfXansgL4gIKD6CijoWADKTAC2AEYwBgAUAJREIfCKVOb0jKwc3Gr8PrpggLwbgKU7LqHKXkWOui5GptmWeTaFWvUyZZX6TR61nTrOfkA)\r\n\r\n### 💻 Code\r\n\r\n```ts\r\nconst u = Symbol();\r\nconst a7 = u as typeof u // widened  to symbol\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\n`a7` is `symbol`\r\n\r\n### 🙂 Expected behavior\r\n\r\n`a7` has `typeof u`\r\n\r\n### Additional information about the issue\r\n\r\nThis issue is a huge problem for isolated declarations as it breaks the assumption that in an expression `const o = a as T` we can always use `T` as the type of  `o`. This is also inconsistent with the way similar expressions work for string/number literal types ([ex](https://www.typescriptlang.org/play?#code/N4KABBYMYPYHYGcAuYCuYC8YBEBBbA3OJLIigIYCMmaY5CYSAngA4CmMAZrQPQ9hwYKAO4BLACZs4bccQilkdAEw10fAULBjJ02ZDAAbNhQDMqug2bsuvfoJESpMuYeN0ALOfXansgL4gIKD6CijoWADKTAC2AEYwBgAUAJREIfCKVOb0jKwc3Gr8PrpggLwbgKU7LqHKXkWOui5GptmWeTaFWvUyZZX6TR61nTrOfkA))\r\n\r\nSimilar issues: \r\n- https://github.com/microsoft/TypeScript/issues/43657 - Widening on return type not on variable declaration \r\n- https://github.com/microsoft/TypeScript/issues/55361 - Similar, explicitly typed variable is widened \r\n- https://github.com/microsoft/TypeScript/issues/36876 - Widening when assigning from object property (but no assertion)\r\n- https://github.com/microsoft/TypeScript/issues/53276\r\n\r\n@Andarist perhaps https://github.com/microsoft/TypeScript/pull/54778 also fixes this?","author":{"url":"https://github.com/dragomirtitian","@type":"Person","name":"dragomirtitian"},"datePublished":"2023-09-28T09:34:26Z","url":"https://github.com/microsoft/TypeScript/issues/55901"}

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:a215491c-59fb-37e1-8816-31ae4cc59129
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEB10:12D34E:6BA5C1:933631:6B047817
html-safe-noncee9b5921bd9f1390fadddf5f6f17b8f3f249123f89446e139aa3cdcc9fb4330d3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjEwOjEyRDM0RTo2QkE1QzE6OTMzNjMxOjZCMDQ3ODE3IiwidmlzaXRvcl9pZCI6IjY3NTU1NDI4MTMxNTQ1MDY3NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac50f5d42e2a2811671898bf18c62d5bbc319fbff46ffdcae595680bcdb3378e6e
hovercard-subject-tagissue:1917095937
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/55901/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bf18b733d12f922b0595a3ff32589f825d10f62a206470375ec41cbc94616866/microsoft/TypeScript/issues/55901
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bf18b733d12f922b0595a3ff32589f825d10f62a206470375ec41cbc94616866/microsoft/TypeScript/issues/55901
og:image:alt🔎 Search Terms unique symbol widening 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link Playground Link 💻 Code const u = Symbol(); const a7 = u as t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedragomirtitian
hostnamegithub.com
expected-hostnamegithub.com
None9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b
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
releasecf73f57448d52b3a7b619195e182b33d3b3454ca
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/55901#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F55901
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%2F55901
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/55901
Reloadhttps://github.com/microsoft/TypeScript/issues/55901
Reloadhttps://github.com/microsoft/TypeScript/issues/55901
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/55901
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/55901
#64451https://github.com/microsoft/TypeScript/pull/64451
unique symbol lost on assignment to const despite type assertion https://github.com/microsoft/TypeScript/issues/55901#top
#64451https://github.com/microsoft/TypeScript/pull/64451
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/dragomirtitian
Titian Cernicova-Dragomir (dragomirtitian)https://github.com/dragomirtitian
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issue-1917095937
Playground Linkhttps://www.typescriptlang.org/play#code/N4KABBYMYPYHYGcAuYCuYC8YBEBBbA3OJLIigIYCMmaY5CYSAngA4CmMAZrQPQ9hwYKAO4BLACZs4bccQilkdAEw10fAULBjJ02ZDAAbNhQDMqug2bsuvfoJESpMuYeN0ALOfXansgL4gIKD6CijoWADKTAC2AEYwBgAUAJREIfCKVOb0jKwc3Gr8PrpggLwbgKU7LqHKXkWOui5GptmWeTaFWvUyZZX6TR61nTrOfkA
exhttps://www.typescriptlang.org/play#code/N4KABBYMYPYHYGcAuYCuYC8YBEBBbA3OJLIigIYCMmaY5CYSAngA4CmMAZrQPQ9hwYKAO4BLACZs4bccQilkdAEw10fAULBjJ02ZDAAbNhQDMqug2bsuvfoJESpMuYeN0ALOfXansgL4gIKD6CijoWADKTAC2AEYwBgAUAJREIfCKVOb0jKwc3Gr8PrpggLwbgKU7LqHKXkWOui5GptmWeTaFWvUyZZX6TR61nTrOfkA
unique symbol type lost after property is extracted from an object #43657https://github.com/microsoft/TypeScript/issues/43657
Explicitly annotated unique symbols are widened in return positions #55361https://github.com/microsoft/TypeScript/issues/55361
Symbol type is incorrectly generalized when used as a property value of an object literal #36876https://github.com/microsoft/TypeScript/issues/36876
unique symbols from the global SymbolConstructor widen way too eagerly #53276https://github.com/microsoft/TypeScript/issues/53276
Mateusz Burzyński (@Andarist)https://github.com/Andarist
#54778https://github.com/microsoft/TypeScript/pull/54778
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issuecomment-1739171572
#54778https://github.com/microsoft/TypeScript/pull/54778
Playground Linkhttps://www.staging-typescript.org/play?noEmit=true&ts=5.3.0-pr-54778-3#code/N4KABBYMYPYHYGcAuYCuYC8YBEBBbA3OJAPQmRgB6A-MRLIigIYCMmaYTCYSAngA4BTGADMOZMHBgoA7gEsAJoLiCFdMBMg11DZJwBM7dBKmzFy1es0RtFADaDmAZiOdufIaPHlTYeUpU1Ck1bSAdmABZXCX8LINJyKloAXxAQUApdFHQsAGVeAFsAIxg7AAoASiJgxJtaTPg9VlcuHgFhMWNyWMCwQF4NwFKdq1qknUbmQywuv3NA4YpQiHDOFym3Ns9OjW7Z1X6hmrr1ZaYotZjd+IgQlKA
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issuecomment-1739357724
#54778https://github.com/microsoft/TypeScript/pull/54778
https://github.com/jakebailey
Jake Bailey (jakebailey)https://github.com/jakebailey
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issuecomment-1739402600
f5b0327https://github.com/microsoft/TypeScript/commit/f5b03276996c72cd4cd1827c0553dcc16132b385
https://github.com/dragomirtitian
Titian Cernicova-Dragomir (dragomirtitian)https://github.com/dragomirtitian
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issuecomment-1739407984
Mateusz Burzyński (@Andarist)https://github.com/Andarist
#54778https://github.com/microsoft/TypeScript/pull/54778
Playground Linkhttps://www.typescriptlang.org/play?ssl=2&ssc=54&pln=1&pc=1#code/KYDwDg9gTgLgBAYwgOwM7wK5wLxwMoCeAtgEYQA2AFAJQDcAUKJLIiunAIYDsOcWHqODAJhgEAGZ84AemlwA7gEsAJsGTBlcIRDipiZckA
https://github.com/Andarist
Mateusz Burzyński (Andarist)https://github.com/Andarist
on Sep 28, 2023https://github.com/microsoft/TypeScript/issues/55901#issuecomment-1739649853
TS playgroundhttps://www.staging-typescript.org/play?ts=5.3.0-pr-54778-3#code/FAUwHgDg9gTgLgAgMZQHYGdEFcEF4EDKAngLYBGUANgBQCUA3KJLIihogIYDseCOH6BHCIQQUAGZ8EAemkIAVKihx5CAO4BLACYhUILUKgJ0pCpSA
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
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 Oct 3, 2023https://github.com/microsoft/TypeScript/issues/55901#event-10540296227
https://github.com/luisfonsivevo
Luis Fonsi VEVO (luisfonsivevo)https://github.com/luisfonsivevo
on Nov 29, 2024https://github.com/microsoft/TypeScript/issues/55901#issuecomment-2508042177
https://github.com/gershy-clutch
gershy-clutchhttps://github.com/gershy-clutch
on Jul 28, 2026https://github.com/microsoft/TypeScript/issues/55901#issuecomment-5107506041
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/55901
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/55901
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%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

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.