René's URL Explorer Experiment


Title: Inconsistent type inferring behavior · Issue #53776 · microsoft/TypeScript · GitHub

Open Graph Title: Inconsistent type inferring behavior · Issue #53776 · microsoft/TypeScript

X Title: Inconsistent type inferring behavior · Issue #53776 · microsoft/TypeScript

Description: Bug Report Hi, we're having issues using inline call of the generic function decorator in a specific context. Unfortunately, I couldn't find anything related to this on stackoverflow, or here. Please check out the code below and feel fre...

Open Graph Description: Bug Report Hi, we're having issues using inline call of the generic function decorator in a specific context. Unfortunately, I couldn't find anything related to this on stackoverflow, or here. Plea...

X Description: Bug Report Hi, we're having issues using inline call of the generic function decorator in a specific context. Unfortunately, I couldn't find anything related to this on stackoverflow, or he...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent type inferring behavior","articleBody":"# Bug Report\r\n\r\nHi, we're having issues using inline call of the generic function decorator in a specific context. Unfortunately, I couldn't find anything related to this on stackoverflow, or here. Please check out the code below and feel free to let me know if more information/context is needed. Thanks!\r\n\r\n### 🔎 Search Terms\r\n\r\n* `infer generic`\r\n* `infer generic function`\r\n\r\n\u003c!--\r\n  What search terms did you use when trying to find an existing bug report?\r\n  List them here so people in the future can find this one more easily.\r\n--\u003e\r\n\r\n### 🕗 Version \u0026 Regression Information\r\n\r\n\u003c!-- When did you start seeing this bug occur?\r\n\r\n\"Bugs\" that have existed in TS for a long time are very likely to be FAQs; refer to\r\n  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs\r\n\r\nIf possible, please try testing the nightly version of TS to see if it's already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n\r\nNote: The TypeScript Playground can be used to try older versions of TypeScript.\r\n\r\nPlease keep and fill in the line that best applies:\r\n--\u003e\r\nThis is the behavior in every version I tried, and I reviewed the FAQ for entries about **inference** and **generics**\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n  A link to a TypeScript Playground \"Share\" link which shows this behavior\r\n\r\n  The TypeScript Workbench can be used for more complex setups, try\r\n  https://www.typescriptlang.org/dev/bug-workbench/\r\n\r\n  As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n--\u003e\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.4#code/GYVwdgxgLglg9mABAEwKbFQJwIoiwTwB4AVAEQEMpyA+ACgG8BfALkXoChFEBHPTfAGJhWtAJSIAvNUQAFTHAC2MAM6oSFKtQDcnRAgDKICBFTLlI5JXKsyV8VMQA3ODGQ7G4jly4B6H4gA6IPZGdnZUAA8ABzhMKERQSFgEFFQIWMo1YhlyTHIFZURIqFQwZELwAGswOAB3MABtAF0AGkRiACVTEAAbKDpdRIgRIICo3Pzzdpy8gvtpOUUVLK7lXv6W3VHx2ansiYL2URF52XklVRJV9ekvRExUKBBMJDFJW91ff1HP+8fnpBDWjbA7KUQ6LiMdxhKD4KKoRAAQUwACMYFA8vwNORJGxdFF5PC4vhWMoMTAwABzdw6cLRWLxIbJJCUx7ItEY3L4bG0AD6rlYYBAChRWGOZyWl3Z6Mx3KszQ+XAeTxeEouqACD2UcB6jlQtAa9AJcCJsNYAHIAIwAJgAzObGE1wSEwmgMDg+PgGLpeAQhKw0Ok8iVaKyoNLOVirG1LQAGUSbLgGIwmMy0SxUTy-PzebwAPQA-L8M+QAsBYgBRcgQAAWtHSYG1PQ1PTglOdkM2HlpDbJiDD2NxgYyIbDEdl2Jj8Z0bqwuAI3q4vv4-v7j0numTxlMynTdjxuZzucQheLVjLlerdd7OpbbY7iEYXedQA)\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well--\u003e\r\n```ts\r\nfunction deferQuery\u003cTData\u003e({}: {\r\n  queryFn: () =\u003e Promise\u003cTData\u003e;\r\n  onSuccess: (data: TData) =\u003e void;\r\n}) {\r\n    // ...\r\n}\r\n\r\nexport function decorate\u003cTParams extends unknown[], TResult\u003e(\r\n  func: (...params: TParams) =\u003e Promise\u003cTResult\u003e,\r\n  ...params: TParams\r\n): () =\u003e Promise\u003cTResult\u003e {\r\n  return () =\u003e {\r\n    // ...\r\n    return func(...params);\r\n  };\r\n}\r\n\r\ntype ArbitraryData = {\r\n  property: string;\r\n};\r\n\r\nexport function getArbitraryData(_id: number): Promise\u003cArbitraryData[]\u003e {\r\n  return Promise.resolve([{property: '123'}]);\r\n}\r\n\r\ndeferQuery({\r\n  queryFn: decorate(getArbitraryData, 10),\r\n  onSuccess(data) {\r\n    //      ^? (parameter) data: unknown\r\n    data.forEach(console.log);\r\n  },\r\n});\r\n\r\nconst getData = decorate(getArbitraryData, 10);\r\ndeferQuery({\r\n  queryFn: getData,\r\n  onSuccess(data) {\r\n    //      ^? (parameter) data: ArbitraryData[]\r\n    data.forEach(console.log);\r\n  },\r\n});\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n`data` is typed as `ArbitraryData[]` only when the decorated method is stored in a variable.\r\n\r\n### 🙂 Expected behavior\r\n\r\n`data` is typed as `ArbitraryData[]` in both cases.\r\n\r\n```ts\r\ndeferQuery({\r\n  queryFn: decorate(getArbitraryData, 10),\r\n  onSuccess(data) {\r\n    //      ^? (parameter) data: ArbitraryData[]\r\n    data.forEach(console.log);\r\n  },\r\n});\r\n\r\nconst getData = decorate(getArbitraryData, 10);\r\ndeferQuery({\r\n  queryFn: getData,\r\n  onSuccess(data) {\r\n    //      ^? (parameter) data: ArbitraryData[]\r\n    data.forEach(console.log);\r\n  },\r\n});\r\n```\r\n","author":{"url":"https://github.com/chernodub","@type":"Person","name":"chernodub"},"datePublished":"2023-04-14T09:29:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/53776/TypeScript/issues/53776"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a9d1a097-1f94-6111-9b6c-a96dfa9c3d2e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8318:841F:7681B:A02DD:6A6266BD
html-safe-nonce4c61b55e607595a62555172be248ca849cacb5af34ca0163ab328fd1e029506d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzE4Ojg0MUY6NzY4MUI6QTAyREQ6NkE2MjY2QkQiLCJ2aXNpdG9yX2lkIjoiNTg2NzQ2MTI0MTI1NTEyNjcxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacfc8cac7ee1228ac00feb57dd6a5f8a50c90aeba4e4c674ef9bd48f90b122d734
hovercard-subject-tagissue:1667890887
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/53776/issue_layout
twitter:imagehttps://opengraph.githubassets.com/337c6ab8fab43a75c241f480c3f807f0c18f5699745ec0076a58fbfc8f80aa12/microsoft/TypeScript/issues/53776
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/337c6ab8fab43a75c241f480c3f807f0c18f5699745ec0076a58fbfc8f80aa12/microsoft/TypeScript/issues/53776
og:image:altBug Report Hi, we're having issues using inline call of the generic function decorator in a specific context. Unfortunately, I couldn't find anything related to this on stackoverflow, or here. Plea...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechernodub
hostnamegithub.com
expected-hostnamegithub.com
None194bddaed53c0eb07047629c520853f4208e77a17ff57428346485cc202e39f2
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
releasec2862cf2db52f0c7f6cba3de21ffeeafe7c5456e
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/53776#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F53776
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%2F53776
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/53776
Reloadhttps://github.com/microsoft/TypeScript/issues/53776
Reloadhttps://github.com/microsoft/TypeScript/issues/53776
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/53776
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
Inconsistent type inferring behaviorhttps://github.com/microsoft/TypeScript/issues/53776#top
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
https://github.com/chernodub
chernodubhttps://github.com/chernodub
on Apr 14, 2023https://github.com/microsoft/TypeScript/issues/53776#issue-1667890887
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=5.0.4#code/GYVwdgxgLglg9mABAEwKbFQJwIoiwTwB4AVAEQEMpyA+ACgG8BfALkXoChFEBHPTfAGJhWtAJSIAvNUQAFTHAC2MAM6oSFKtQDcnRAgDKICBFTLlI5JXKsyV8VMQA3ODGQ7G4jly4B6H4gA6IPZGdnZUAA8ABzhMKERQSFgEFFQIWMo1YhlyTHIFZURIqFQwZELwAGswOAB3MABtAF0AGkRiACVTEAAbKDpdRIgRIICo3Pzzdpy8gvtpOUUVLK7lXv6W3VHx2ansiYL2URF52XklVRJV9ekvRExUKBBMJDFJW91ff1HP+8fnpBDWjbA7KUQ6LiMdxhKD4KKoRAAQUwACMYFA8vwNORJGxdFF5PC4vhWMoMTAwABzdw6cLRWLxIbJJCUx7ItEY3L4bG0AD6rlYYBAChRWGOZyWl3Z6Mx3KszQ+XAeTxeEouqACD2UcB6jlQtAa9AJcCJsNYAHIAIwAJgAzObGE1wSEwmgMDg+PgGLpeAQhKw0Ok8iVaKyoNLOVirG1LQAGUSbLgGIwmMy0SxUTy-PzebwAPQA-L8M+QAsBYgBRcgQAAWtHSYG1PQ1PTglOdkM2HlpDbJiDD2NxgYyIbDEdl2Jj8Z0bqwuAI3q4vv4-v7j0numTxlMynTdjxuZzucQheLVjLlerdd7OpbbY7iEYXedQA
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%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.