Title: two lines in an interface cause a build time explosion [strictGenericChecks] · Issue #18257 · microsoft/TypeScript · GitHub
Open Graph Title: two lines in an interface cause a build time explosion [strictGenericChecks] · Issue #18257 · microsoft/TypeScript
X Title: two lines in an interface cause a build time explosion [strictGenericChecks] · Issue #18257 · microsoft/TypeScript
Description: TypeScript Version: Tested on 2.5.2 and 2.6.0-dev.20170904 Code The code is there: https://github.com/emmanueltouzery/prelude.ts/tree/5c33c1eeeea7234506e54331d06590e2feb9b00d To build it you can just run npm install && tsc. It's about 18...
Open Graph Description: TypeScript Version: Tested on 2.5.2 and 2.6.0-dev.20170904 Code The code is there: https://github.com/emmanueltouzery/prelude.ts/tree/5c33c1eeeea7234506e54331d06590e2feb9b00d To build it you can ju...
X Description: TypeScript Version: Tested on 2.5.2 and 2.6.0-dev.20170904 Code The code is there: https://github.com/emmanueltouzery/prelude.ts/tree/5c33c1eeeea7234506e54331d06590e2feb9b00d To build it you can ju...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/18257
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"two lines in an interface cause a build time explosion [strictGenericChecks]","articleBody":"**TypeScript Version:** Tested on 2.5.2 and 2.6.0-dev.20170904\r\n\r\n**Code**\r\n\r\nThe code is there:\r\nhttps://github.com/emmanueltouzery/prelude.ts/tree/5c33c1eeeea7234506e54331d06590e2feb9b00d\r\n\r\nTo build it you can just run `npm install && tsc`. It's about 1800 LOCs of typescript.\r\n\r\nOn my (old) machine, if I build it as-is with 2.5 or 2.6-dev I get a ~5s build time. If I uncomment in `src/IMap.ts` [lines 29 and 30](https://github.com/emmanueltouzery/prelude.ts/blob/5c33c1eeeea7234506e54331d06590e2feb9b00d/src/IMap.ts#L28-L30), however, the build time explodes. On 2.5 I didn't bother waiting but it would be a long, long, long time. On 2.6-dev the speed is much better but the build time still explodes from 5 seconds to 35 seconds.\r\n\r\nThe two lines are:\r\n```typescript\r\n mapValuesStruct\u003cV2>(fn:(v:V)=>V2): IMap\u003cK,V2>;\r\n mapValues\u003cV2>(fn:(v:V)=>V2&WithEquality): IMap\u003cK,V2>;\r\n```\r\n\r\nAnd they are implemented in `src/HashMap.ts` with:\r\n\r\n```typescript\r\n map\u003cK2,V2>(fn:(k:K&WithEquality, v:V)=>[K2&WithEquality,V2&WithEquality]): HashMap\u003cK2,V2> {\r\n return this.mapStruct(fn);\r\n }\r\n\r\n mapValuesStruct\u003cV2>(fn:(v:V)=>V2): HashMap\u003cK,V2> {\r\n return this.hamt.fold(\r\n (acc: HashMap\u003cK,V2>, value: V, key: K&WithEquality) =>\r\n acc.putStruct(key,fn(value)), HashMap.empty());\r\n }\r\n```\r\n\r\nWhen I implement the interface, I change the return type to a more specific one, which is as far as I'm aware, legal.\r\n\r\n**Expected behavior:**\r\nUncommenting these two lines of code shouldn't cause the build time to increase sevenfold. Maybe the code is wrong, but then I should get a compilation error or a warning, not an increased build time.\r\n\r\nIf I put in the `tsconfig.json`:\r\n`\"noStrictGenericChecks\": true`\r\n\r\nthen the performance issue goes away completely even with the lines uncommented.","author":{"url":"https://github.com/emmanueltouzery","@type":"Person","name":"emmanueltouzery"},"datePublished":"2017-09-05T19:47:25Z","url":"https://github.com/microsoft/TypeScript/issues/18257"}
| 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:d743e9ae-14b9-4482-86f5-a7699c56e565 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDC0:1F44:15B929:1CBC52:6B00DEE7 |
| html-safe-nonce | 9cd165809a625f3083616a30004adaa817c9806cc9482f798c7e3a16a09700d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREMwOjFGNDQ6MTVCOTI5OjFDQkM1Mjo2QjAwREVFNyIsInZpc2l0b3JfaWQiOiI3NDQ5NTE0NzU1NDM5NTE3NDE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9cba9da2c844bc151008839f0384966f3e184a57f584a4f61bc58858c0e7eec8 |
| hovercard-subject-tag | issue:255387981 |
| 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/18257/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de6f2c6860a1c1da37ec78b7fc5be3206269285b9dede9d3d49e924497b4577d/microsoft/TypeScript/issues/18257 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de6f2c6860a1c1da37ec78b7fc5be3206269285b9dede9d3d49e924497b4577d/microsoft/TypeScript/issues/18257 |
| og:image:alt | TypeScript Version: Tested on 2.5.2 and 2.6.0-dev.20170904 Code The code is there: https://github.com/emmanueltouzery/prelude.ts/tree/5c33c1eeeea7234506e54331d06590e2feb9b00d To build it you can ju... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | emmanueltouzery |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width