René's URL Explorer Experiment


Title: typescript passes `number | Promise` as if it were `number` (or something like that) · Issue #52036 · microsoft/TypeScript · GitHub

Open Graph Title: typescript passes `number | Promise` as if it were `number` (or something like that) · Issue #52036 · microsoft/TypeScript

X Title: typescript passes `number | Promise` as if it were `number` (or something like that) · Issue #52036 · microsoft/TypeScript

Description: Bug Report Something is very weird that makes typescript pass Promise as if it were a number when it is an object field. Typescript correctly recognizes that Promise is not a number when it is a plain variable. Weird. 🔎 S...

Open Graph Description: Bug Report Something is very weird that makes typescript pass Promise as if it were a number when it is an object field. Typescript correctly recognizes that Promise is not a number...

X Description: Bug Report Something is very weird that makes typescript pass Promise<number> as if it were a number when it is an object field. Typescript correctly recognizes that Promise<number> is ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"typescript passes `number | Promise\u003cnumber\u003e` as if it were `number` (or something like that)","articleBody":"# Bug Report\r\n\r\nSomething is very weird that makes typescript pass `Promise\u003cnumber\u003e` as if it were a `number` when it is an object field.  Typescript correctly recognizes that `Promise\u003cnumber\u003e` is not a number when it is a plain variable.  Weird.\r\n\r\n### 🔎 Search Terms\r\n\r\npromise numeric\r\n\r\n### 🕗 Version \u0026 Regression Information\r\n\r\nI believe this has always existed in typescript.  I have tried multiple versions on playground (from 3.3 up to 5).   I did read the FAQs in https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs and found nothing related.\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.0-dev.20221227#code/MYewdgzgLgBGBccCuBbARgUwE4wD4wAUsQUBLCDAHjFUywD4YBeQ4sigOiwwhABsAbhgAUABgCUAbgBQoSPwwc+IAObCwMeiwmSYMAPT6YAYRBZuwKHwCeMbgCsMljABNEAeQAO2AIZQzmizAPmBgILCYMD6ennykrjD+rCTkVDTo2IwhLsgZWBzSsuDQMABmICCIAN4IuXR4yexptJkAvswwVdJ6tUQpnNy8giISADTSrTJyQ4rKauUgHBpaMDoGRgCSYKDmTla2UNbeMMAAFk4A1hAcegBKSGBQpCgYdjxIfLDkMGiqSNfSIA)\r\n\r\n### 💻 Code\r\n\r\n```ts\r\nconst n: number | Promise\u003cnumber\u003e = Promise.resolve(0);\r\nconsole.log(n \u003e= 0);  // Correctly rejected: Operator \u003e= cannot be applied to Promise\u003cnumber\u003e and number.\r\n\r\nconst foo: {n: number | Promise\u003cnumber\u003e} = {\r\n  n: Promise.resolve(0),\r\n};\r\nconsole.log(foo.n \u003e= 0); // Incorrectly type checks.  Runtime result is bogus.\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nThe last expression passes the type checker even though it is clearly wrong.\r\n\r\n### 🙂 Expected behavior\r\n\r\nThat the last expression is rejected with `Operator \u003e= cannot be applied to Promise\u003cnumber\u003e and number.`.","author":{"url":"https://github.com/azizghuloum","@type":"Person","name":"azizghuloum"},"datePublished":"2022-12-28T00:51:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/52036/TypeScript/issues/52036"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:41c8b845-63d7-3b33-3d7d-13f31ec0feba
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idECC8:17CBFE:985309:CD5DC7:6A62B413
html-safe-nonce27678ca2f0945c4cfd272a2b373a91274706ed37ebb908dcbbddbce9a9f2ecaf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQ0M4OjE3Q0JGRTo5ODUzMDk6Q0Q1REM3OjZBNjJCNDEzIiwidmlzaXRvcl9pZCI6IjM1NDAxMzMwOTE5MzQ5MDk0NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac55caa28b40ca79687d77e05ca9e0fa49e225c8087ab95a4153a15e1b648b5822
hovercard-subject-tagissue:1512294916
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/52036/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d779154f46d234c736a74f7df729add020b701f2235e3021e1d014568aeb9c0a/microsoft/TypeScript/issues/52036
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d779154f46d234c736a74f7df729add020b701f2235e3021e1d014568aeb9c0a/microsoft/TypeScript/issues/52036
og:image:altBug Report Something is very weird that makes typescript pass Promise as if it were a number when it is an object field. Typescript correctly recognizes that Promise is not a number...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameazizghuloum
hostnamegithub.com
expected-hostnamegithub.com
None2738d7125e864b55224a8bc40c72c220ca7d2c73f91a7bb8d69dffe9d35e997d
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
releasebf54af498459157b66a67136f992a68752cdbb54
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/52036#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F52036
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F52036
Sign up https://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/52036
Reloadhttps://github.com/microsoft/TypeScript/issues/52036
Reloadhttps://github.com/microsoft/TypeScript/issues/52036
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/52036
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 21 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
#52048https://github.com/microsoft/TypeScript/pull/52048
typescript passes number | Promise as if it were number (or something like that)https://github.com/microsoft/TypeScript/issues/52036#top
#52048https://github.com/microsoft/TypeScript/pull/52048
Experimentation NeededSomeone needs to try this out to see what happenshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experimentation%20Needed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/azizghuloum
azizghuloumhttps://github.com/azizghuloum
on Dec 28, 2022https://github.com/microsoft/TypeScript/issues/52036#issue-1512294916
https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugshttps://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=5.0.0-dev.20221227#code/MYewdgzgLgBGBccCuBbARgUwE4wD4wAUsQUBLCDAHjFUywD4YBeQ4sigOiwwhABsAbhgAUABgCUAbgBQoSPwwc+IAObCwMeiwmSYMAPT6YAYRBZuwKHwCeMbgCsMljABNEAeQAO2AIZQzmizAPmBgILCYMD6ennykrjD+rCTkVDTo2IwhLsgZWBzSsuDQMABmICCIAN4IuXR4yexptJkAvswwVdJ6tUQpnNy8giISADTSrTJyQ4rKauUgHBpaMDoGRgCSYKDmTla2UNbeMMAAFk4A1hAcegBKSGBQpCgYdjxIfLDkMGiqSNfSIA
Experimentation NeededSomeone needs to try this out to see what happenshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experimentation%20Needed%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.