Title: Incorrect inference of arrow function with intersected mapped type argument under strictFunctionTypes · Issue #32664 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect inference of arrow function with intersected mapped type argument under strictFunctionTypes · Issue #32664 · microsoft/TypeScript
X Title: Incorrect inference of arrow function with intersected mapped type argument under strictFunctionTypes · Issue #32664 · microsoft/TypeScript
Description: TypeScript Version: 3.6.0-dev.20190801 Search Terms: inference intersection type strictFunctionTypes Code type MappedIntersection
Open Graph Description: TypeScript Version: 3.6.0-dev.20190801 Search Terms: inference intersection type strictFunctionTypes Code type MappedIntersection X Description: TypeScript Version: 3.6.0-dev.20190801 Search Terms: inference intersection type strictFunctionTypes Code type MappedIntersection<T extends {}> = { [P in keyof T]: string } & {}; type Map...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32664
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect inference of arrow function with intersected mapped type argument under strictFunctionTypes","articleBody":"\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.6.0-dev.20190801\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** `inference` `intersection type` `strictFunctionTypes`\r\n\r\n**Code**\r\n\r\n```ts\r\ntype MappedIntersection\u003cT extends {}> = { [P in keyof T]: string } & {};\r\ntype MappedRaw\u003cT extends {}> = { [P in keyof T]: string };\r\n\r\n// Case 1: Intersection + no arrow = succeed\r\ntype ToInferNoArrowIntersection\u003cT extends {}> = {\r\n fn(params: MappedIntersection\u003cT>): void;\r\n};\r\n\r\ntype NoArrowIntersection\u003cT extends ToInferNoArrowIntersection\u003cany>> = void;\r\ndeclare const case1: NoArrowIntersection\u003c{\r\n fn: (params: MappedIntersection\u003c{a: 1}>) => string,\r\n}>;\r\n\r\n\r\n// Case 2: No intersection + arrow = succeed\r\ntype ToInferArrowNoIntersection\u003cT extends {}> = {\r\n fn: (params: MappedRaw\u003cT>) => void;\r\n};\r\n\r\ntype ArrowNoIntersection\u003cT extends ToInferArrowNoIntersection\u003cany>> = void;\r\ndeclare const case2: ArrowNoIntersection\u003c{\r\n fn: (params: MappedRaw\u003c{a: 1}>) => void,\r\n}>;\r\n\r\n\r\n// Case 3: Intersection + arrow = fail\r\ntype ToInferArrowIntersection\u003cT extends {}> = {\r\n fn: (params: MappedIntersection\u003cT>) => void;\r\n};\r\n\r\ntype ArrowIntersection\u003cT extends ToInferArrowIntersection\u003cany>> = void;\r\ndeclare const case3: ArrowIntersection\u003c{ // Fails here\r\n fn: (params: MappedIntersection\u003c{a: 1}>) => void,\r\n}>;\r\n```\r\n\r\n**Expected behavior:**\r\nExpected case 3 to succeed.\r\n\r\n**Actual behavior:**\r\nCase 3 produces:\r\n```\r\n Type '{ fn: (params: { a: string; }) => void; }' does not satisfy the constraint 'ToInferArrowIntersection\u003cany>'.\r\n Types of property 'fn' are incompatible.\r\n Type '(params: { a: string; }) => void' is not assignable to type '(params: { [x: string]: string; }) => void'.\r\n Types of parameters 'params' and 'params' are incompatible.\r\n Property 'a' is missing in type '{ [x: string]: string; }' but required in type '{ a: string; }'.\r\n```\r\nSeems relevant that compilation succeeds without `strictFunctionTypes`\r\n\r\n\r\n**Playground Link:** [Playground](https://www.typescriptlang.org/play/#code/C4TwDgpgBAsghmSATAkgO2BATgZwgY2AEsB7NAHgBUoIAPTNJHKAbwF8A+KAXlagG0AClCJooAawggSAMyiUAugC4oOYFlEBzKGygAyVmwDcAKFCRYCZACU4Adyo16ERs3ZdeLAcNESps+WVVdS0dUxMAegioAGE4PCgARhV0TFwCYjIoAGooNBIoOCwsEjseVQBXfHwICCQzcGhKEnQZbAA5EgBBYtLU7DxCUgpqOgYmQw9WEyhZqBk0AAowIrgAWxwVeEQ6-vShsioOAEoVADcSIiRTYxMGi06ekrs9wcyRp3HmZtaO7t6XhgBhlhuQ4GgQBwphcrqYkAQADZFaD4MhqKD4eIQZJQR4A14gw4sGZzBYqZarDZbKy7IH7d7kFhwFSJTjHHhcNQaNCaAA0Jk44Ui0TiCQATCpOiI6W9hjlCgDyjgqjU6vcmi00G0sE9Sp0CQcPmMXBN3OViXN5mhySssOtNpYdkhbA5KCcOVAYdcBeFzNBdXZ9TLCUbnK55JrtQGg2lZYdwZDoZdvfD8EisCi0cAMViJVBo5rYyHGSTZmSoBS7VTHTZ7IzmUk2R6vfzBXdhbEsVAAMwpYOG+VFZ7lGRwIgI9UR346-H9hmjMOmzjm0tWm2Uh3bZAG+fu7hcL03X2NfOzouGxzG8M-LXYAM70EJqHlQ8mVPpzNodGYvC90-PB8iVXctK3taknUAigmRZJt909ZNWw4UwgA)\r\n\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\nhttps://github.com/microsoft/TypeScript/issues/29123#issuecomment-453884098\r\nhttps://github.com/microsoft/TypeScript/issues/31081","author":{"url":"https://github.com/smoogly","@type":"Person","name":"smoogly"},"datePublished":"2019-08-01T18:42:43Z","url":"https://github.com/microsoft/TypeScript/issues/32664"}
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:1aec2762-49f7-52dd-1a65-51b50d6cd5f9 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id CB88:842EC:2BFB8EF:3AADA50:6B01CE9F html-safe-nonce 0500c5330932118374537b2483233c79ce6072d1397c013a23e9f49c05d2947c visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjg4Ojg0MkVDOjJCRkI4RUY6M0FBREE1MDo2QjAxQ0U5RiIsInZpc2l0b3JfaWQiOiIyMTkyMzIyNDQyNjQ1NTg5NjYzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 460adb92008254a954dd3b4b40a19f2dd5b9de4e5133f670044cf8f224e5b07d hovercard-subject-tag issue:475832266 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/32664/issue_layout twitter:image https://opengraph.githubassets.com/5d420fa30a81be0efa679c7dc7848291b7df7a70310853efdb69461807ab0e40/microsoft/TypeScript/issues/32664 twitter:card summary_large_image og:image https://opengraph.githubassets.com/5d420fa30a81be0efa679c7dc7848291b7df7a70310853efdb69461807ab0e40/microsoft/TypeScript/issues/32664 og:image:alt TypeScript Version: 3.6.0-dev.20190801 Search Terms: inference intersection type strictFunctionTypes Code type MappedIntersection og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username smoogly 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
URLs of crawlers that visited me.