René's URL Explorer Experiment


Title: Inference to generic overloaded construct signatures fails · Issue #35641 · microsoft/TypeScript · GitHub

Open Graph Title: Inference to generic overloaded construct signatures fails · Issue #35641 · microsoft/TypeScript

X Title: Inference to generic overloaded construct signatures fails · Issue #35641 · microsoft/TypeScript

Description: TypeScript Version: 3.8.0-dev.20191210 (nightly) Search Terms: inference generic overload construct signature Code declare class MySet { constructor(iterable?: Iterable | null) // constructor(iterable?: readonly T[] | null); readon...

Open Graph Description: TypeScript Version: 3.8.0-dev.20191210 (nightly) Search Terms: inference generic overload construct signature Code declare class MySet { constructor(iterable?: Iterable | null) // constructor...

X Description: TypeScript Version: 3.8.0-dev.20191210 (nightly) Search Terms: inference generic overload construct signature Code declare class MySet<T> { constructor(iterable?: Iterable<T> | null) //...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inference to generic overloaded construct signatures fails","articleBody":"**TypeScript Version:**  3.8.0-dev.20191210 (nightly)\r\n\r\n**Search Terms:** inference generic overload construct signature\r\n\r\n**Code**\r\n\r\n```ts\r\ndeclare class MySet\u003cT> {\r\n    constructor(iterable?: Iterable\u003cT> | null)\r\n    // constructor(iterable?: readonly T[] | null);\r\n    readonly size: number;\r\n    add(value: T): this;\r\n    clear(): void;\r\n    delete(value: T): boolean;\r\n    forEach(callbackfn: (value: T, value2: T, set: Set\u003cT>) => void, thisArg?: any): void;\r\n    has(value: T): boolean;\r\n}\r\n\r\ndeclare function collect\u003cT, U>(it: Iterable\u003cT>, collector: new (iterable: Iterable\u003cT>) => U): U;\r\n\r\ncollect([1, 2, 3], Set); // expected: Set\u003cnumber>, actual: Set\u003cunknown>\r\ncollect([1, 2, 3], MySet); // expected: MySet\u003cnumber>, actual: MySet\u003cnumber>\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nThe return type of the 1st call to `collect` should be `Set\u003cnumber>`, similar to how the return type of the 2nd call to `collect` is `MySet\u003cnumber>`\r\n\r\n**Actual behavior:**\r\n\r\nThe return type of the 1st call to `collect` is `Set\u003cunknown>`. This seems to be due to the combination of the following definitions:\r\n\r\n```ts\r\n// lib.es2015.collection.d.ts\r\ninterface SetConstructor {\r\n    new \u003cT = any>(values?: readonly T[] | null): Set\u003cT>;\r\n    readonly prototype: Set\u003cany>;\r\n}\r\ndeclare var Set: SetConstructor;\r\n\r\n// lib.es2015.iterable.d.ts\r\ninterface SetConstructor {\r\n    new \u003cT>(iterable?: Iterable\u003cT> | null): Set\u003cT>;\r\n}\r\n```\r\n\r\nCommenting out the first construct signature for `SetConstructor` (in lib.es2015.collection.d.ts) produces the correct return type for `collect`. Likewise, uncommenting the similar `constructor` definition in `MySet` above results in `collect` producing the incorrect return type as well.\r\n\r\n**Playground Link:** [🔗](https://www.typescriptlang.org/play/?ts=3.8.0-dev.20191210#code/CYUwxgNghgTiAEkoGdnwLIE8DKIAuAPACoB88A3gFDw2ID2AdsnjAK5h50wAUAlniBhQARhBAB+AFzwAkgKGiQxMgB94DVhAgBKANzVaAekP0mLdpx79BIsVPhwowRhEzwiAbQC68NRq16BjSOzgyu8Mi8AF4g0hoAtsKC+rTwTsDcAG5QEKyx7trSeAAWvMgptJAgsNyF8Jl0vMAVNKBiAlk5edJEdcJ0dGJQDC3wAGZcAKJQYMXcYDkQwjMA1mMM0p25+UQANPVdIABMPfvI+NK4hKTa8AC8ZA1N+yVlAIIwAOb2w5h1T80gvBiigtt0CtJ+oNqiNKABfSiUUBIODjVgMDi8Rj0LTga77ACqJD48ls+TkNkUyn2YEGYg4XDiIAA7vASZSxNIKQoxMpbg94AS6gT9JRabiONwPABGfZHfYAZi8+yuengxngIAAHgAHPEgYCXfAEBJJGAkfYzPCsHJGwjolYMOjMhgkMV0vFS2XweXwJX7LCq3TqkzavUcA3SQPG02CC1pDg2iBRnAx1iJONAA)\r\n\r\n**Related Issues:** #25917, #35636 (possibly related?)\r\n","author":{"url":"https://github.com/rbuckton","@type":"Person","name":"rbuckton"},"datePublished":"2019-12-12T00:08:30Z","url":"https://github.com/microsoft/TypeScript/issues/35641"}

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:7ca1e360-37df-771b-2f6f-5f441aee9aa2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB4FC:B53AF:8CCF40:BD36E2:6B00E3EE
html-safe-nonce16c7246fc07005cf33fc65ab28c30838051d6485f3305b1cebbf3e1a1742c923
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNEZDOkI1M0FGOjhDQ0Y0MDpCRDM2RTI6NkIwMEUzRUUiLCJ2aXNpdG9yX2lkIjoiMjk1OTE4MjExNDU0MjY0MjE1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca0e571da2be3fde53eaa1d6852809049d4671f77de447ca5bf22aa2bdc56d9ea
hovercard-subject-tagissue:536682555
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/35641/issue_layout
twitter:imagehttps://opengraph.githubassets.com/68df72973900b1816fc0f82bb286255e03efdaeaf320c14c9806d2b3c33d335c/microsoft/TypeScript/issues/35641
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/68df72973900b1816fc0f82bb286255e03efdaeaf320c14c9806d2b3c33d335c/microsoft/TypeScript/issues/35641
og:image:altTypeScript Version: 3.8.0-dev.20191210 (nightly) Search Terms: inference generic overload construct signature Code declare class MySet { constructor(iterable?: Iterable | null) // constructor...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerbuckton
hostnamegithub.com
expected-hostnamegithub.com
None27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14
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
release624179fb8b88d26ba5bba08894eb60a1c5a1d93d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/35641#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F35641
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%2F35641
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/35641
Reloadhttps://github.com/microsoft/TypeScript/issues/35641
Reloadhttps://github.com/microsoft/TypeScript/issues/35641
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/35641
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/35641
Inference to generic overloaded construct signatures failshttps://github.com/microsoft/TypeScript/issues/35641#top
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Dec 12, 2019https://github.com/microsoft/TypeScript/issues/35641#issue-536682555
🔗https://www.typescriptlang.org/play/?ts=3.8.0-dev.20191210#code/CYUwxgNghgTiAEkoGdnwLIE8DKIAuAPACoB88A3gFDw2ID2AdsnjAK5h50wAUAlniBhQARhBAB+AFzwAkgKGiQxMgB94DVhAgBKANzVaAekP0mLdpx79BIsVPhwowRhEzwiAbQC68NRq16BjSOzgyu8Mi8AF4g0hoAtsKC+rTwTsDcAG5QEKyx7trSeAAWvMgptJAgsNyF8Jl0vMAVNKBiAlk5edJEdcJ0dGJQDC3wAGZcAKJQYMXcYDkQwjMA1mMM0p25+UQANPVdIABMPfvI+NK4hKTa8AC8ZA1N+yVlAIIwAOb2w5h1T80gvBiigtt0CtJ+oNqiNKABfSiUUBIODjVgMDi8Rj0LTga77ACqJD48ls+TkNkUyn2YEGYg4XDiIAA7vASZSxNIKQoxMpbg94AS6gT9JRabiONwPABGfZHfYAZi8+yuengxngIAAHgAHPEgYCXfAEBJJGAkfYzPCsHJGwjolYMOjMhgkMV0vFS2XweXwJX7LCq3TqkzavUcA3SQPG02CC1pDg2iBRnAx1iJONAA
#25917https://github.com/microsoft/TypeScript/issues/25917
#35636https://github.com/microsoft/TypeScript/issues/35636
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Dec 12, 2019https://github.com/microsoft/TypeScript/issues/35641#issuecomment-564956153
Type inference in conditional typeshttp://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%22
on Jan 27, 2020https://github.com/microsoft/TypeScript/issues/35641#event-2983536985
https://github.com/ChuckJonas
Charlie Jonas (ChuckJonas)https://github.com/ChuckJonas
on Aug 7, 2020https://github.com/microsoft/TypeScript/issues/35641#issuecomment-670347078
Playground Linkhttps://www.typescriptlang.org/play?ts=4.0.0-beta#code/C4TwDgpgBAwghgGwQIzgYwNYFEBOOoC8UuOA9vgD5QDOwOAlgHYDmUVjArkgNwBQokWIhToMAHgBKAPkJQAFBDwAuIUlSYSAGig4I1LsBUSAlIRlxGIXv3DQAYh0Zpg9UowDq9YAAt4a0WIAKlAQAB7AEIwAJtRQFiAA2gC62tKycgB0WXA4zNQqCVkZgdp+IpiSUkmmBOaWfLxobrRQYGQAtvTU9ABmIGXqGLJiAJIh4ZExcZbJqVJyPY5oKg5OLm6ePgMBI3M1MpnZuflQI8YqAAodXRCVZlAA3rxQOhDAHDiMUIwQAO5QV1InWoEDkcl01FICAAbhBtLoAFYQZz7R7PF5QRZOQ4ZHJ5bQKZSqcrYPDwvQGIyop4YjG6d6fEJ4KAAfleSOchJwphUEKhsPBFIQwGMfFpAF9jOjJXxxdYsc5XF9dHAonZ6AhQeiehqICpaAwWJp0WhkCouSoSOQ2N8uAhyfphfq6ExmKjoaR6FFeOcoB6vXwFetlRBVerNXJtbrnYbmMaXgI9bb2shFPGoKbzYocJa8Nb2HaHZSaC6WO7Pd7ff6ooGlsHXmHdZGXkU8Sd4j60S96R9GLLrE1GC1QrI2kCur1+sJBoLG5rRUA
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 1, 2021https://github.com/microsoft/TypeScript/issues/35641#event-4828181471
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/35641
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/35641
Design LimitationConstraints of the existing architecture prevent this from being fixedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Limitation%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.