Title: Cannot infer from usage when generic class does not have a member or function parameter/return value of the generic type. · Issue #10609 · microsoft/TypeScript · GitHub
Open Graph Title: Cannot infer from usage when generic class does not have a member or function parameter/return value of the generic type. · Issue #10609 · microsoft/TypeScript
X Title: Cannot infer from usage when generic class does not have a member or function parameter/return value of the generic type. · Issue #10609 · microsoft/TypeScript
Description: TypeScript Version: 2.1.0-dev.20160830 Code interface A
Open Graph Description: TypeScript Version: 2.1.0-dev.20160830 Code interface A
X Description: TypeScript Version: 2.1.0-dev.20160830 Code interface A<T> { test(value: Object): value is T; // a: T; // No error if uncommented. // or test(value: T | Object): value is T; } type B<T>...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/10609
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot infer from usage when generic class does not have a member or function parameter/return value of the generic type.","articleBody":"**TypeScript Version:** 2.1.0-dev.20160830\n\n**Code**\n\n``` ts\ninterface A\u003cT> {\n test(value: Object): value is T;\n // a: T; // No error if uncommented.\n // or test(value: T | Object): value is T;\n}\n\ntype B\u003cT> = T | A\u003cT>;\n\nfunction f1\u003cT>(b: B\u003cT>) {}\n\nfunction f2\u003cT>(b: B\u003cT>) {\n f1(b); // The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.\n // Type argument candidate 'T' is not a valid type argument because it is not a supertype of candidate 'T'.\n}\n```\n\n**Expected behavior:**\nNo error.\n\n**Actual behavior:** \nThe error reported with the code.\n\nNote that this may seem same as #8619, however here, adding a member of type T, or a function with a parameter/return value of type T, solves the issue.\n","author":{"url":"https://github.com/stephanedr","@type":"Person","name":"stephanedr"},"datePublished":"2016-08-30T14:36:55Z","url":"https://github.com/microsoft/TypeScript/issues/10609"}
| 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:735c5787-5d20-08dd-3d93-192a31367c50 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5D4:24ACB9:F5C7E4:1442CDD:6B0101C6 |
| html-safe-nonce | be83c930ec7288eb1a7fc9d4115c86cb024e2eab61b36e3288153992bd79d2e0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUQ0OjI0QUNCOTpGNUM3RTQ6MTQ0MkNERDo2QjAxMDFDNiIsInZpc2l0b3JfaWQiOiI1NDQwMDYyNDcwMDQ1NjMwOTE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2b70a124edadac5d05293c5ee2823bd01765c79af86f64c51579c46d4838d23d |
| hovercard-subject-tag | issue:174036830 |
| 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/10609/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3994d0723d747546fa960389a02b99b1a5350efacebfbd38fc2426a0e361a87/microsoft/TypeScript/issues/10609 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3994d0723d747546fa960389a02b99b1a5350efacebfbd38fc2426a0e361a87/microsoft/TypeScript/issues/10609 |
| og:image:alt | TypeScript Version: 2.1.0-dev.20160830 Code interface A |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | stephanedr |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width