René's URL Explorer Experiment


Title: Generic parameter type checking stops too early · Issue #59049 · microsoft/TypeScript · GitHub

Open Graph Title: Generic parameter type checking stops too early · Issue #59049 · microsoft/TypeScript

X Title: Generic parameter type checking stops too early · Issue #59049 · microsoft/TypeScript

Description: 🔎 Search Terms generic, early, permature, defer 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________ ⏯ Playground Link https://www.typescriptlang.org/play/?s...

Open Graph Description: 🔎 Search Terms generic, early, permature, defer 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________ ⏯ Playground Lin...

X Description: 🔎 Search Terms generic, early, permature, defer 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________ ⏯ Playground...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic parameter type checking stops too early","articleBody":"### 🔎 Search Terms\r\n\r\ngeneric, early, permature, defer\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play/?ssl=10&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgEoRgeQEYCsIJgA8AKgHzIDeAUMncggK5RQTgBcyJyAPsiIwA2g6gF9q1ACYFBcVshiMQhYAHsQySAGcwACgAendFjwFiAgLbZoZAJScAbquCSA3FJlyUi5WDUaAcwgwY117NAwcfEIiS2soXn4hQTJ3akFg5AdkAF5kIJCMMPdtPQdbdyA\r\n\r\n### 💻 Code\r\n\r\n```ts\r\ninterface RefObject\u003cT> {\r\n    current: T | null\r\n}\r\n\r\ndeclare function test(x: RefObject\u003cnumber>): void;\r\ndeclare function getRef(): RefObject\u003cnumber | null>;\r\n\r\nlet v = getRef();\r\ntest(v);\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\nIn the above code, `RefObject` is defined to always accept `null` in its `current` property. However, if one explicitly writes `RefObject\u003cnumber | null>` and passes the result to a parameter accepting `RefObject\u003cnumber>` TS reports a type error even though the types of the `current` property would have been the same. This happens with any type, not just null (e.g. if the definition of current was `T | string`.\r\n\r\n### 🙂 Expected behavior\r\n\r\nSince the `current` properties are equivalent after substituting the generic parameters, there should be no error. It seems like TS is stopping as soon as it sees `RefObject\u003cnumber | null>` vs `RefObject\u003cnumber>` even though substituting the generic parameter would result in the same type. This can be confirmed by creating a copy of the RefObject type like this:\r\n\r\n```ts\r\ninterface RefObject\u003cT> {\r\n    current: T | null\r\n}\r\n\r\ninterface RefObject2\u003cT> {\r\n    current: T | null\r\n}\r\n\r\ndeclare function test(x: RefObject\u003cnumber>): void;\r\ndeclare function getRef(): RefObject2\u003cnumber | null>;\r\n\r\nlet v = getRef();\r\ntest(v);\r\n```\r\n\r\n[Playground](https://www.typescriptlang.org/play/?ts=5.5.2&ssl=14&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgEoRgeQEYCsIJgA8AKgHzIDeAUMncggK5RQTgBcyJyAPsiIwA2g6gF9q1UJFiIU6LHgJgATKQo16DZqw5de-ISPHUAJgUFxWyGIxCFgAexDJIAZzAAKAB6d5OfIREAgC22NBkAJScAG4OwCYA3Kbmlig2dmCOzgDmEGDyHlFoGP5KqiFhUPoCwmRJ1IJ5yNHIALzIufkYhUluntERSUA)\r\n\r\n### Additional information about the issue\r\n\r\nThis affects the change in React's types between version 18 and 19, where the `RefObject` type changed `current` from `T | null` to only `T`. The uses of `RefObject` should add `null` instead, e.g. `RefObject\u003cHTMLDivElement | null>`. Making libraries compatible with both the React 18 and React 19 types is difficult due to this TS issue. If a library updates its implementation to React 19, including `RefObject\u003cHTMLElement | null>` in its definitions, consumers still using React 18 types will see TS errors.\r\n\r\ncc. @eps1lon in case you know about this","author":{"url":"https://github.com/devongovett","@type":"Person","name":"devongovett"},"datePublished":"2024-06-27T02:15:55Z","url":"https://github.com/microsoft/TypeScript/issues/59049"}

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:e81de0fc-b5c8-e765-fa4c-3adfe712bfb3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id86F8:2454CC:2E9000F:3B1F6E4:6B01C141
html-safe-nonce254cd6fe6d65f4b4cfb42ff26233039dcfb7f1cc368ca0b7b323f0d1ffba9839
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkY4OjI0NTRDQzoyRTkwMDBGOjNCMUY2RTQ6NkIwMUMxNDEiLCJ2aXNpdG9yX2lkIjoiNzU3MTUzNjY3MDM5OTUxMjg5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb03ff2506cede804f0e94461ca469e2e7b4f19b24ce43025f64d6afa25b23b03
hovercard-subject-tagissue:2376565418
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/59049/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7d360eb6281411c45ab4fbcf03173b34a8c80a9cc111fa5d0be16d684530e8fe/microsoft/TypeScript/issues/59049
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7d360eb6281411c45ab4fbcf03173b34a8c80a9cc111fa5d0be16d684530e8fe/microsoft/TypeScript/issues/59049
og:image:alt🔎 Search Terms generic, early, permature, defer 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________ ⏯ Playground Lin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevongovett
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/59049#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F59049
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%2F59049
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/59049
Reloadhttps://github.com/microsoft/TypeScript/issues/59049
Reloadhttps://github.com/microsoft/TypeScript/issues/59049
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/59049
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/59049
Generic parameter type checking stops too earlyhttps://github.com/microsoft/TypeScript/issues/59049#top
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/devongovett
Devon Govett (devongovett)https://github.com/devongovett
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issue-2376565418
https://www.typescriptlang.org/play/?ssl=10&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgEoRgeQEYCsIJgA8AKgHzIDeAUMncggK5RQTgBcyJyAPsiIwA2g6gF9q1ACYFBcVshiMQhYAHsQySAGcwACgAendFjwFiAgLbZoZAJScAbquCSA3FJlyUi5WDUaAcwgwY117NAwcfEIiS2soXn4hQTJ3akFg5AdkAF5kIJCMMPdtPQdbdyAhttps://www.typescriptlang.org/play/?ssl=10&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgEoRgeQEYCsIJgA8AKgHzIDeAUMncggK5RQTgBcyJyAPsiIwA2g6gF9q1ACYFBcVshiMQhYAHsQySAGcwACgAendFjwFiAgLbZoZAJScAbquCSA3FJlyUi5WDUaAcwgwY117NAwcfEIiS2soXn4hQTJ3akFg5AdkAF5kIJCMMPdtPQdbdyA
Playgroundhttps://www.typescriptlang.org/play/?ts=5.5.2&ssl=14&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgEoRgeQEYCsIJgA8AKgHzIDeAUMncggK5RQTgBcyJyAPsiIwA2g6gF9q1UJFiIU6LHgJgATKQo16DZqw5de-ISPHUAJgUFxWyGIxCFgAexDJIAZzAAKAB6d5OfIREAgC22NBkAJScAG4OwCYA3Kbmlig2dmCOzgDmEGDyHlFoGP5KqiFhUPoCwmRJ1IJ5yNHIALzIufkYhUluntERSUA
Sebastian "Sebbie" Silbermann (@eps1lon)https://github.com/eps1lon
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2193037255
https://github.com/devongovett
Devon Govett (devongovett)https://github.com/devongovett
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2193470936
https://github.com/eps1lon
Sebastian "Sebbie" Silbermann (eps1lon)https://github.com/eps1lon
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2194230682
https://github.com/devongovett
Devon Govett (devongovett)https://github.com/devongovett
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2195247087
adobe/react-spectrum#6632https://github.com/adobe/react-spectrum/pull/6632
https://github.com/eps1lon
Sebastian "Sebbie" Silbermann (eps1lon)https://github.com/eps1lon
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2195512048
https://github.com/devongovett
Devon Govett (devongovett)https://github.com/devongovett
on Jun 27, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2195559903
Playgroundhttps://www.typescriptlang.org/play/?ts=5.5.2#code/JYWwDg9gTgLgBAJQKYEMDGMA0cDeyBmA8gEYBWSGAvnPlBCHAORSoaMDcAUJwCYUA2KFjQCuAOwzAIYuCIDOSABIQIAawAqACxQxkMEVDFyCACgCUALkRIiZCjAA8i9QFkAMgBFgANwCi-JBAkMXgAHzgxEX5+AD4uTnxxSWk4dSQ5GHNcTjhcuAD4Fnw4AF5ZBWU1LR09AyNTMy48uBZ9QzgHHh8WmxKcIuoAehjOSk4gA
https://github.com/eps1lon
Sebastian "Sebbie" Silbermann (eps1lon)https://github.com/eps1lon
on Jun 28, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2196320120
https://github.com/devongovett
Devon Govett (devongovett)https://github.com/devongovett
on Jun 28, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2197493512
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 12, 2024https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2226202948
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 Jul 26, 2024https://github.com/microsoft/TypeScript/issues/59049#event-13666236028
https://github.com/CraigMacomber
Craig Macomber (Microsoft) (CraigMacomber)https://github.com/CraigMacomber
on Apr 2, 2025https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693
Playgroundhttps://www.typescriptlang.org/play/?ssl=24&ssc=1&pln=1&pc=1#code/C4TwDgpgBAKg9gawgOygXigRgNxQPR5QDKcAttAM6QDGAlgIYA2UAbkwK4QBQXBUAglFCQoAd1rAAFlGpkwjWtXrAIAE1b0ATg2TUIAOl6EAsnArAoAcxQRNTGfQrRaFMZJRQABvCTJPUFygmRjhRNUNhaABhTQhlCAAeGAA+dCgAbygADwAuWEQPCCyVZFVXGCgAfih2ZARkUNQ82CgAX2wePhhROADVFGBFe1pkFU0AM3o9CkM+ACF2Sys4CFd6UXoQAPGhdycg2KFwaH7xkYlaOGRXEfM49TgdkbHJ6cNn21foAA1MJNSiiUylAYnEVP8Mq0uB8JlMfgAmCGAlDA0HxCHpKFcSJQACSyDA7AsGHhHT4UTkROgwB6fQGQ2YkVc7AoIyWvyCpSg33h2OOUAASqt2IxgJg0r8EvjCcBkh0cUKKCLgPCJYjpUS5Z1CDB3HTRgyjpA1ocGhYIABHdhMAA0UAamgO1L1tH6BqUzBhXxmfJEAH1qO5qAhMKqMLErbRYvwKKzLMh6AAjRgQeAJRXKzB2nlJArIZJanEBoMh8Xhy3sKMQGNxhPJ1NwdPC0VZ7l-HwoAu4PgZ0VQcaaMhtgKuM1BWO0eNJlNCXq-O1XRhbHm+6DFiDB+FhqARyvRidT+tp3sq7OIjv5uX4Qgn-uD0jc1WBMeOWvT6lz+EL5BLturqDrpuZY7hWVY1pOdYpsezanm2ua+F2PA4ruYEHpBDYJH6gjIqUrhzHacypBgwCaJwHRAA
Craig Macomber (Microsoft) (CraigMacomber)https://github.com/CraigMacomber
on Apr 2, 2025https://github.com/microsoft/TypeScript/issues/59049#event-17101245032
Workaround TypeScript type checking optimization which has undesirabl…https://github.com/microsoft/FluidFramework/commit/1cad35844c71edd24590ee4a124331d16419abe0
1cad358https://github.com/microsoft/FluidFramework/commit/1cad35844c71edd24590ee4a124331d16419abe0
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/59049
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/59049
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

Viewport: width=device-width


URLs of crawlers that visited me.