Title: False positive assignment error with generics when using --strictBindCallApply · Issue #28900 · microsoft/TypeScript · GitHub
Open Graph Title: False positive assignment error with generics when using --strictBindCallApply · Issue #28900 · microsoft/TypeScript
X Title: False positive assignment error with generics when using --strictBindCallApply · Issue #28900 · microsoft/TypeScript
Description: TypeScript Version: 3.3.0-dev.20181207 Search Terms: bind generic strict Code class SomeClass { constructor() { this.genericMethod = this.genericMethod.bind(this); // TS2322: Type '(callback: (p: {}) => {}) => void' is not // assignable ...
Open Graph Description: TypeScript Version: 3.3.0-dev.20181207 Search Terms: bind generic strict Code class SomeClass { constructor() { this.genericMethod = this.genericMethod.bind(this); // TS2322: Type '(callback: (p: {...
X Description: TypeScript Version: 3.3.0-dev.20181207 Search Terms: bind generic strict Code class SomeClass { constructor() { this.genericMethod = this.genericMethod.bind(this); // TS2322: Type '(callback: (...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/28900
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive assignment error with generics when using --strictBindCallApply","articleBody":"\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. --\u003e\r\n**TypeScript Version:** 3.3.0-dev.20181207\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) --\u003e\r\n**Search Terms:** bind generic strict\r\n\r\n**Code**\r\n\r\n```ts\r\nclass SomeClass {\r\n\r\n constructor() {\r\n this.genericMethod = this.genericMethod.bind(this);\r\n \r\n // TS2322: Type '(callback: (p: {}) =\u003e {}) =\u003e void' is not\r\n // assignable to type '\u003cT\u003e(callback: (p: T) =\u003e T) =\u003e void':\r\n this.genericWithCallback = this.genericWithCallback.bind(this);\r\n }\r\n\r\n genericMethod\u003cT\u003e(p: T): void { }\r\n\r\n genericWithCallback\u003cT\u003e(callback: (p: T) =\u003e T): void { }\r\n}\r\n```\r\n\r\nCompile with `tsc TypeScriptIssue.ts --target es6 --strictBindCallApply`\r\n\r\n**Expected behavior:**\r\nNo compile error\r\n\r\n**Actual behavior:**\r\n```plain\r\nerror TS2322: Type '(callback: (p: {}) =\u003e {}) =\u003e void' is not assignable to type '\u003cT\u003e(callback: (p: T) =\u003e T) =\u003e void'.\r\n Types of parameters 'callback' and 'callback' are incompatible.\r\n Types of parameters 'p' and 'p' are incompatible.\r\n Type '{}' is not assignable to type 'T'.\r\n```\r\n\r\n\r\n**Playground Link:** (no --strictBindCallApply flag available)\r\n\r\n**Related issues:**\r\n* https://github.com/Microsoft/TypeScript/pull/27028\r\n* https://github.com/Microsoft/TypeScript/issues/28582\r\n","author":{"url":"https://github.com/ulrichb","@type":"Person","name":"ulrichb"},"datePublished":"2018-12-07T13:27:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/28900/TypeScript/issues/28900"}
| 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:3d538729-2174-47c1-6cd4-4c9dcd9a406d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD2A:22BA6F:817B27:B1C62E:6A61B835 |
| html-safe-nonce | d56fdc57523955f44fa9d3f9c7f2ef673c372e5f55e06aee7d3c27f8e636aed5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDJBOjIyQkE2Rjo4MTdCMjc6QjFDNjJFOjZBNjFCODM1IiwidmlzaXRvcl9pZCI6IjE5NDc1NDU0MzYwMjc5OTIxMTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cfae2b3adcf43b8ea7381d03430c4e7a429330a102c5eeb32b8caf4e57c78de7 |
| hovercard-subject-tag | issue:388654628 |
| 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/28900/issue_layout |
| twitter:image | https://opengraph.githubassets.com/59cbbde941c757adc77c1909e7ee1cd4472375886596f4ee4c18273866a81fe1/microsoft/TypeScript/issues/28900 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/59cbbde941c757adc77c1909e7ee1cd4472375886596f4ee4c18273866a81fe1/microsoft/TypeScript/issues/28900 |
| og:image:alt | TypeScript Version: 3.3.0-dev.20181207 Search Terms: bind generic strict Code class SomeClass { constructor() { this.genericMethod = this.genericMethod.bind(this); // TS2322: Type '(callback: (p: {... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ulrichb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6f4633bcf01c1ad14b73fd07dd39ac31d61f3d3c2578ee08ec1792b7b351eeb9 |
| 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 | ac296ae7f21856f1f92adbad22f870b6fbb4b907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width