Title: Inconsistent type errors depending on order of statements · Issue #32209 · microsoft/TypeScript · GitHub
Open Graph Title: Inconsistent type errors depending on order of statements · Issue #32209 · microsoft/TypeScript
X Title: Inconsistent type errors depending on order of statements · Issue #32209 · microsoft/TypeScript
Description: TypeScript Version: 3.6.0-dev.20190701, 3.5.2 (Not present in 3.4.5) Search Terms: inconsistent error typing order interface Code type A = { a: number }; type B = { b: number }; type X Open Graph Description: TypeScript Version: 3.6.0-dev.20190701, 3.5.2 (Not present in 3.4.5) Search Terms: inconsistent error typing order interface Code type A = { a: number }; type B = { b: number }; type X X Description: TypeScript Version: 3.6.0-dev.20190701, 3.5.2 (Not present in 3.4.5) Search Terms: inconsistent error typing order interface Code type A = { a: number }; type B = { b: number }; type X<T> = (...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32209
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent type errors depending on order of statements","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.6.0-dev.20190701, 3.5.2 (Not present in 3.4.5)\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\ninconsistent error typing order interface \r\n\r\n**Code**\r\n\r\n```ts\r\ntype A = { a: number };\r\ntype B = { b: number };\r\ntype X\u003cT> = ({ [K in keyof T]: T[K] } & Record\u003cstring, void>)[keyof T];\r\ntype P1\u003cT> = { data: X\u003cT> };\r\ntype P2\u003cT> = { data: X\u003cT> };\r\n\r\ninterface I\u003cT> {\r\n fn\u003cK extends keyof T>(p1: P1\u003cPick\u003cT, K>>, p2: P2\u003cPick\u003cT, K>>): void;\r\n}\r\n\r\nconst i: I\u003cA & B> = null as any;\r\nconst p2: P2\u003cA> = null as any;\r\n\r\n// Commenting out the below line will remove the error on the `const _i: I\u003cA> = i;`\r\ni.fn(null as any, p2);\r\n\r\nconst _i: I\u003cA> = i;\r\n```\r\n\r\nThe above code sample is a simplified version of real code in our code base. I tried simplifying it further but thats as far as I got.\r\n\r\n**Expected behavior:**\r\n\r\nThe `i.fn(null as any, p2);` should have no effect on the typing of the `const _i: I\u003cA> = i;` line.\r\n\r\n**Actual behavior:**\r\n\r\nWhen `i.fn(null as any, p2);` is present, there is an error on `const _i: I\u003cA> = i;`, \r\nWhen `i.fn(null as any, p2);` is removed OR moved after `const _i: I\u003cA> = i;`, the error disappears.\r\n\r\nError:\r\n```\r\ntest.ts:15:7 - error TS2322: Type 'I\u003cA & B>' is not assignable to type 'I\u003cA>'.\r\n Type 'A' is not assignable to type 'A & B'.\r\n Property 'b' is missing in type 'A' but required in type 'B'.\r\n\r\n15 const _i: I\u003cA> = i;\r\n ~~\r\n\r\n test.ts:2:12\r\n 2 type B = { b: number };\r\n ~\r\n 'b' is declared here.\r\n\r\n\r\nFound 1 error.\r\n```\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\nI was not able to reproduce in the playground. But an empty `compilerOptions` and `tsc` will reliably reproduce the error in the listed versions.\r\n\r\nv3.4.5 consistently provides no errors\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n","author":{"url":"https://github.com/WearyMonkey","@type":"Person","name":"WearyMonkey"},"datePublished":"2019-07-02T05:26:42Z","url":"https://github.com/microsoft/TypeScript/issues/32209"}
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:5d68dc21-0241-c6ed-0afc-4d5502bd81d4 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id B368:3DA1E8:E4ABEA:130560D:6B01D52F html-safe-nonce a64afd238983e9ec993630406658632a460c116761f9e8bb77fd77ec27ecd03e visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzY4OjNEQTFFODpFNEFCRUE6MTMwNTYwRDo2QjAxRDUyRiIsInZpc2l0b3JfaWQiOiI0MjE2NTE0NzMzNjc2ODExNTY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 862790186bbaaad55973faedac9318be1df9ca241c9b2ab230f51e8c67f6d125 hovercard-subject-tag issue:463026496 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/32209/issue_layout twitter:image https://opengraph.githubassets.com/2e037d71e532647c79cf130743fbd44bcaa35a6b2a0a9b2c40100ba72b11607b/microsoft/TypeScript/issues/32209 twitter:card summary_large_image og:image https://opengraph.githubassets.com/2e037d71e532647c79cf130743fbd44bcaa35a6b2a0a9b2c40100ba72b11607b/microsoft/TypeScript/issues/32209 og:image:alt TypeScript Version: 3.6.0-dev.20190701, 3.5.2 (Not present in 3.4.5) Search Terms: inconsistent error typing order interface Code type A = { a: number }; type B = { b: number }; type X og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username WearyMonkey 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.