Title: Regression: something is wrong with type checking in dev.20180919 · Issue #27223 · microsoft/TypeScript · GitHub
Open Graph Title: Regression: something is wrong with type checking in dev.20180919 · Issue #27223 · microsoft/TypeScript
X Title: Regression: something is wrong with type checking in dev.20180919 · Issue #27223 · microsoft/TypeScript
Description: TypeScript Version: Version 3.1.0-dev.20180919 Code This code compiles in v3.0.3 but fails in 3.1.0-dev.20180919. /** Represents a React/preact component with a state property and setState method. */ export type StatefulComponent = { ...
Open Graph Description: TypeScript Version: Version 3.1.0-dev.20180919 Code This code compiles in v3.0.3 but fails in 3.1.0-dev.20180919. /** Represents a React/preact component with a state property and setState method. ...
X Description: TypeScript Version: Version 3.1.0-dev.20180919 Code This code compiles in v3.0.3 but fails in 3.1.0-dev.20180919. /** Represents a React/preact component with a state property and setState method. ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27223
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression: something is wrong with type checking in dev.20180919","articleBody":"**TypeScript Version:** Version 3.1.0-dev.20180919\r\n\r\n**Code**\r\n\r\nThis code compiles in v3.0.3 but fails in 3.1.0-dev.20180919.\r\n\r\n```ts\r\n/** Represents a React/preact component with a state property and setState method. */\r\nexport type StatefulComponent\u003cS> = {\r\n state: S, setState: (s: any /*Partial\u003cS>*/) => any\r\n};\r\n\r\nexport function f\u003cThis extends StatefulComponent\u003cS>, S=This[\"state\"]>(component: This): void\r\n{\r\n if (Math.random()>0.5) f(component);\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nCompiles without error.\r\n\r\n**Actual behavior:**\r\n\r\n~~~\r\nhold.ts:8:28 - error TS2345: Argument of type 'This' is not assignable to parameter of type 'StatefulComponent\u003cThis[\"state\"]>'.\r\n Type 'StatefulComponent\u003cS>' is not assignable to type 'StatefulComponent\u003cThis[\"state\"]>'.\r\n Types of property 'state' are incompatible.\r\n Type 'S' is not assignable to type 'This[\"state\"]'.\r\n\r\n8 if (Math.random()>0.5) f(component);\r\n~~~\r\n\r\n**Playground Link:** No error in Playground.\r\n","author":{"url":"https://github.com/qwertie","@type":"Person","name":"qwertie"},"datePublished":"2018-09-19T19:43:38Z","url":"https://github.com/microsoft/TypeScript/issues/27223"}
| 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:ee9e2454-9e7c-c799-6832-f6d2ddbc67d9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EE2:33D24F:2DF7315:3B0B212:6B01CB2D |
| html-safe-nonce | a96fc269af177aac6e5730483bb45d5100555b69f5a29e55c6a32f8aa8f69ac6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUUyOjMzRDI0RjoyREY3MzE1OjNCMEIyMTI6NkIwMUNCMkQiLCJ2aXNpdG9yX2lkIjoiNTU3MTEzMjQ3MjM0OTAxODkyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aff5f578d490db17695e2f86254811f6a289504b23b332966612fbece22afb64 |
| hovercard-subject-tag | issue:361899304 |
| 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/27223/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5ef7d187256ac6ae291c1da2b65e2f6e922044ec964bd76af22460c4aaa1aeae/microsoft/TypeScript/issues/27223 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5ef7d187256ac6ae291c1da2b65e2f6e922044ec964bd76af22460c4aaa1aeae/microsoft/TypeScript/issues/27223 |
| og:image:alt | TypeScript Version: Version 3.1.0-dev.20180919 Code This code compiles in v3.0.3 but fails in 3.1.0-dev.20180919. /** Represents a React/preact component with a state property and setState method. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | qwertie |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width