René's URL Explorer Experiment


Title: Recursive generics in function parameters are inferred as {}, and produce funky Intellisense · Issue #17522 · microsoft/TypeScript · GitHub

Open Graph Title: Recursive generics in function parameters are inferred as {}, and produce funky Intellisense · Issue #17522 · microsoft/TypeScript

X Title: Recursive generics in function parameters are inferred as {}, and produce funky Intellisense · Issue #17522 · microsoft/TypeScript

Description: TypeScript Version: 2.4.2 Code function build>(options: O) {} interface Options { data?: {}; processSelf(self: TSelf); } build({ data: { hello: "world" }, processSelf(self) { self.data.hello; } }); Expected be...

Open Graph Description: TypeScript Version: 2.4.2 Code function build>(options: O) {} interface Options { data?: {}; processSelf(self: TSelf); } build({ data: { hello: "world" }, processSelf(se...

X Description: TypeScript Version: 2.4.2 Code function build<O extends Options<O>>(options: O) {} interface Options<TSelf> { data?: {}; processSelf(self: TSelf); } build({ data: { hello: "w...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Recursive generics in function parameters are inferred as {}, and produce funky Intellisense","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\r\n**TypeScript Version:**  2.4.2\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction build\u003cO extends Options\u003cO>>(options: O) {}\r\n\r\ninterface Options\u003cTSelf> {\r\n    data?: {};\r\n    processSelf(self: TSelf);\r\n}\r\n\r\nbuild({\r\n    data: { hello: \"world\" },\r\n    processSelf(self) {\r\n        self.data.hello;\r\n    }\r\n});\r\n```\r\n\r\n**Expected behavior:**\r\nThe inferred type of `O` should be the type of the options object passed in.\r\n`self` should be of type `O`.\r\n`self.data.hello` should be accessible within the `processSelf` function.\r\n\r\nIf this is not supposed to work, I would expect `O extends Options\u003cO>` to be an error.\r\n\r\n**Actual behavior:**\r\nThe inferred type of `O` is `Options\u003c{}>`.\r\n`self` is of type `{}`.\r\n`self.data.hello` is therefore not accessible.\r\n\r\nAdditionally, the Intellisense VSCode is providing for this seems to be wrong, or at least confusing. If this is unrelated then I'm happy to make a separate issue for that and remove it from here.\r\n\r\nAs these screenshots show, `self` is inferred as `{}` but it allows access to `self.data`. `self.data` is given type `any` according to the tooltip, but the error at `.hello` is\r\n\r\n> Property 'hello' does not exist on type '{}'.\r\n\r\n\r\nWhen I explicitly specify `self: {}`, `self.data` becomes an error.\r\n\r\n![image](https://user-images.githubusercontent.com/19550501/28759272-25e4de70-7593-11e7-8a9c-f2f14d327f28.png)\r\n![image](https://user-images.githubusercontent.com/19550501/28759276-391d44a0-7593-11e7-97c9-b93ae08d04c3.png)\r\n\r\n**Real scenario:**\r\nIn my real scenario `Options` has many more optional properties, and I want `self` to have only the properties specified, not every optional property. There are also many optional functions with the signature of `processSelf(self: TSelf)` and they do need to be part of the same options object.","author":{"url":"https://github.com/SamPruden","@type":"Person","name":"SamPruden"},"datePublished":"2017-07-31T01:23:19Z","url":"https://github.com/microsoft/TypeScript/issues/17522"}

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:d52b6e43-f704-0344-e5b6-24f934c93fdb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB260:1DCB8C:C975BB:10BBD7D:6B00F545
html-safe-nonceeee97ec30966d969b5c12cd0a6e2ef49037bb38a2a275c692e3b6fee4d26e0be
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjYwOjFEQ0I4QzpDOTc1QkI6MTBCQkQ3RDo2QjAwRjU0NSIsInZpc2l0b3JfaWQiOiI3OTU1NTcwNDYyNTAxNjk2ODM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6e826472daa5580af94ecba587cae26725620653c8521491d690c0a9701527d4
hovercard-subject-tagissue:246623319
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/17522/issue_layout
twitter:imagehttps://opengraph.githubassets.com/565301280e357dcf40dbe38a9d34c8f8751b415a2524f3cd472256fcd27495cc/microsoft/TypeScript/issues/17522
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/565301280e357dcf40dbe38a9d34c8f8751b415a2524f3cd472256fcd27495cc/microsoft/TypeScript/issues/17522
og:image:altTypeScript Version: 2.4.2 Code function build>(options: O) {} interface Options { data?: {}; processSelf(self: TSelf); } build({ data: { hello: "world" }, processSelf(se...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSamPruden
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/17522#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F17522
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%2F17522
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/17522
Reloadhttps://github.com/microsoft/TypeScript/issues/17522
Reloadhttps://github.com/microsoft/TypeScript/issues/17522
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/17522
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17522
Recursive generics in function parameters are inferred as {}, and produce funky Intellisensehttps://github.com/microsoft/TypeScript/issues/17522#top
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
https://github.com/SamPruden
Sam (SamPruden)https://github.com/SamPruden
on Jul 31, 2017https://github.com/microsoft/TypeScript/issues/17522#issue-246623319
https://user-images.githubusercontent.com/19550501/28759272-25e4de70-7593-11e7-8a9c-f2f14d327f28.png
https://user-images.githubusercontent.com/19550501/28759276-391d44a0-7593-11e7-97c9-b93ae08d04c3.png
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Aug 1, 2017https://github.com/microsoft/TypeScript/issues/17522#issuecomment-319433729
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Aug 1, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1188052572
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Aug 1, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1188052862
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Aug 1, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1188052970
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Aug 31, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1230492047
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Nov 6, 2017https://github.com/microsoft/TypeScript/issues/17522#issuecomment-342326089
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Nov 6, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1328700658
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Nov 6, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1328700742
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Nov 6, 2017https://github.com/microsoft/TypeScript/issues/17522#issuecomment-342326354
https://github.com/typescript-bot
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
on Nov 21, 2017https://github.com/microsoft/TypeScript/issues/17522#issuecomment-346150243
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 21, 2017https://github.com/microsoft/TypeScript/issues/17522#event-1352791010
microsofthttps://github.com/microsoft
on Jun 14, 2018https://github.com/microsoft/TypeScript/issues/17522#event-1682137326
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/17522
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17522
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%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.