Title: unsound type constraints · Issue #8459 · microsoft/TypeScript · GitHub
Open Graph Title: unsound type constraints · Issue #8459 · microsoft/TypeScript
X Title: unsound type constraints · Issue #8459 · microsoft/TypeScript
Description: interface I { fn:
Open Graph Description: interface I { fn:
X Description: interface I { fn: <T>(t: T) => void; } interface X { x: number; } function toI<T extends X>() : I { return { fn: (t: T) => { // <-- expected a warning from the compiler that th...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/8459
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"unsound type constraints","articleBody":"``` typescript\ninterface I {\n fn: \u003cT>(t: T) => void;\n}\ninterface X {\n x: number;\n}\nfunction toI\u003cT extends X>() : I {\n return {\n fn: (t: T) => { // \u003c-- expected a warning from the compiler that the type constraint cannot be enforced\n alert(t.x);\n }\n };\n}\nfunction test(i: I): void {\n i.fn({}); // \u003c-- problem unnoticed\n}\ntest(toI\u003cX>()); // displays \"undefined\"\n```\n","author":{"url":"https://github.com/zpdDG4gta8XKpMCd","@type":"Person","name":"zpdDG4gta8XKpMCd"},"datePublished":"2016-05-04T09:04:27Z","url":"https://github.com/microsoft/TypeScript/issues/8459"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bf4be032-cbe5-5c8d-34a1-ec7716e8a374 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA0C:117C62:804B0F:AD1485:6B00E0F9 |
| html-safe-nonce | 13a11ed71ff5000c26afbdac784252108d613cf888a6f259298a25f4f60f0d0b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTBDOjExN0M2Mjo4MDRCMEY6QUQxNDg1OjZCMDBFMEY5IiwidmlzaXRvcl9pZCI6IjQ0MjQyMzk4MzQ4MTAzNDM2NzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a43884d88b015aaebcb0a4ea397744de97e85ceaafc9ac5a412a59b83d5de827 |
| hovercard-subject-tag | issue:152964136 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/8459/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1e27f472dfcb9cc935fa1f7b493932515e39d3307f3f7d8ed8cb02317d8f4bba/microsoft/TypeScript/issues/8459 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1e27f472dfcb9cc935fa1f7b493932515e39d3307f3f7d8ed8cb02317d8f4bba/microsoft/TypeScript/issues/8459 |
| og:image:alt | interface I { fn: |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zpdDG4gta8XKpMCd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width