Title: [PERFORMANCE]: TS takes several seconds to validate types resulting in poor DX · Issue #54939 · microsoft/TypeScript · GitHub
Open Graph Title: [PERFORMANCE]: TS takes several seconds to validate types resulting in poor DX · Issue #54939 · microsoft/TypeScript
X Title: [PERFORMANCE]: TS takes several seconds to validate types resulting in poor DX · Issue #54939 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms 🕗 Version & Regression Information This is a slow type verification leading to bad DX. ⏯ Playground Link Playground link with relevant code Related issue: drizzle-team/drizzle-orm#870 💻 Code // We can quickly ad...
Open Graph Description: Bug Report 🔎 Search Terms 🕗 Version & Regression Information This is a slow type verification leading to bad DX. ⏯ Playground Link Playground link with relevant code Related issue: drizzle-team/dri...
X Description: Bug Report 🔎 Search Terms 🕗 Version & Regression Information This is a slow type verification leading to bad DX. ⏯ Playground Link Playground link with relevant code Related issue: drizzle-team...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/54939
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[PERFORMANCE]: TS takes several seconds to validate types resulting in poor DX","articleBody":"# Bug Report\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n\r\n\u003c!--\r\n What search terms did you use when trying to find an existing bug report?\r\n List them here so people in the future can find this one more easily.\r\n-->\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n\u003c!-- When did you start seeing this bug occur?\r\n\r\n\"Bugs\" that have existed in TS for a long time are very likely to be FAQs; refer to\r\n https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs\r\n\r\nIf possible, please try testing the nightly version of TS to see if it's already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n\r\nNote: The TypeScript Playground can be used to try older versions of TypeScript.\r\n\r\nPlease keep and fill in the line that best applies:\r\n-->\r\n- This is a slow type verification leading to bad DX.\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n A link to a TypeScript Playground \"Share\" link which shows this behavior.\r\n This should have the same code as the code snippet below, and use whichever settings are relevant to your report.\r\n\r\n As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n-->\r\n[Playground link with relevant code](https://stackblitz.com/edit/stackblitz-starters-vgeb6t?description=&file=index.ts,package.json&title=json-server%20Starter)\r\n\r\nRelated issue: https://github.com/drizzle-team/drizzle-orm/issues/870\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well. This code and the Playground code should be the same, do not use separate examples -->\r\n```ts\r\n// We can quickly address your report if:\r\n// - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!\r\n// - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.\r\n// - The incorrectness of the behavior is readily apparent from reading the sample.\r\n// Reports are slower to investigate if:\r\n// - We have to pare too much extraneous code.\r\n// - We have to clone a large repo and validate that the problem isn't elsewhere.\r\n// - The sample is confusing or doesn't clearly demonstrate what's wrong.\r\n```\r\n\r\nI understand that this issue uses an external library, `drizzle` which is the source of performance problems. However, I think it would be useful for the TS team to see how people use types in real world and to see if either the `drizzle` team can fix the types to be better performant or the TS team can do something to better handle the use cases used by `drizzle`.\r\n\r\n\r\n```typescript\r\nimport { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';\r\n\r\n/**\r\n * This is a reproduction of slow TypeScript type validation with Drizzle.\r\n *\r\n * Steps to reproduce:\r\n * 1. Change \"EDIT THIS\" line and change `2` to `\"2\"` (add qoutes around the number)\r\n * and save the file\r\n * 2. Because we have changed number to string the TS will now underline the line as\r\n * being invalid.\r\n * 3. Go back and forth between the `2` and `\"2\"` and notice that there is a several\r\n * second delay everytime you change source code and TS either has to add or remove\r\n * the red underline. (TS Error)\r\n * 4. Once you establish a beseline feel to how long it takes TS to add/removo an error,\r\n * comment out the `delayCount`/`latencyCount` block and repeat the steps\r\n * 5. Notice that now the add/remove error is instant.\r\n */\r\n\r\nconst x: number = 2; // EDIT THIS\r\n\r\nexport const edgeTable = sqliteTable('edges', {\r\n id: integer('id').primaryKey(),\r\n manifestHash: text('manifest_hash').notNull(),\r\n from: text('from'),\r\n to: text('to').notNull(),\r\n interaction: integer('interaction').notNull(),\r\n\r\n // COMMENT OUT THE LINES BELOW\r\n //////////////////////////////\r\n // START\r\n\r\n delayCount00: integer('delay_count_00').notNull(),\r\n delayCount01: integer('delay_count_01').notNull(),\r\n delayCount02: integer('delay_count_02').notNull(),\r\n delayCount03: integer('delay_count_03').notNull(),\r\n delayCount04: integer('delay_count_04').notNull(),\r\n delayCount05: integer('delay_count_05').notNull(),\r\n delayCount06: integer('delay_count_06').notNull(),\r\n delayCount07: integer('delay_count_07').notNull(),\r\n delayCount08: integer('delay_count_08').notNull(),\r\n delayCount09: integer('delay_count_09').notNull(),\r\n delayCount10: integer('delay_count_10').notNull(),\r\n delayCount11: integer('delay_count_11').notNull(),\r\n delayCount12: integer('delay_count_12').notNull(),\r\n delayCount13: integer('delay_count_13').notNull(),\r\n delayCount14: integer('delay_count_14').notNull(),\r\n delayCount15: integer('delay_count_15').notNull(),\r\n delayCount16: integer('delay_count_16').notNull(),\r\n delayCount17: integer('delay_count_17').notNull(),\r\n delayCount18: integer('delay_count_18').notNull(),\r\n delayCount19: integer('delay_count_19').notNull(),\r\n delayCount20: integer('delay_count_20').notNull(),\r\n delayCount21: integer('delay_count_21').notNull(),\r\n delayCount22: integer('delay_count_22').notNull(),\r\n delayCount23: integer('delay_count_23').notNull(),\r\n delayCount24: integer('delay_count_24').notNull(),\r\n delayCount25: integer('delay_count_25').notNull(),\r\n delayCount26: integer('delay_count_26').notNull(),\r\n delayCount27: integer('delay_count_27').notNull(),\r\n delayCount28: integer('delay_count_28').notNull(),\r\n delayCount29: integer('delay_count_29').notNull(),\r\n delayCount30: integer('delay_count_30').notNull(),\r\n delayCount31: integer('delay_count_31').notNull(),\r\n delayCount32: integer('delay_count_32').notNull(),\r\n delayCount33: integer('delay_count_33').notNull(),\r\n delayCount34: integer('delay_count_34').notNull(),\r\n delayCount35: integer('delay_count_35').notNull(),\r\n delayCount36: integer('delay_count_36').notNull(),\r\n delayCount37: integer('delay_count_37').notNull(),\r\n delayCount38: integer('delay_count_38').notNull(),\r\n delayCount39: integer('delay_count_39').notNull(),\r\n delayCount40: integer('delay_count_40').notNull(),\r\n delayCount41: integer('delay_count_41').notNull(),\r\n delayCount42: integer('delay_count_42').notNull(),\r\n delayCount43: integer('delay_count_43').notNull(),\r\n delayCount44: integer('delay_count_44').notNull(),\r\n delayCount45: integer('delay_count_45').notNull(),\r\n delayCount46: integer('delay_count_46').notNull(),\r\n delayCount47: integer('delay_count_47').notNull(),\r\n delayCount48: integer('delay_count_48').notNull(),\r\n delayCount49: integer('delay_count_49').notNull(),\r\n latencyCount00: integer('latency_count_00').notNull(),\r\n latencyCount01: integer('latency_count_01').notNull(),\r\n latencyCount02: integer('latency_count_02').notNull(),\r\n latencyCount03: integer('latency_count_03').notNull(),\r\n latencyCount04: integer('latency_count_04').notNull(),\r\n latencyCount05: integer('latency_count_05').notNull(),\r\n latencyCount06: integer('latency_count_06').notNull(),\r\n latencyCount07: integer('latency_count_07').notNull(),\r\n latencyCount08: integer('latency_count_08').notNull(),\r\n latencyCount09: integer('latency_count_09').notNull(),\r\n latencyCount10: integer('latency_count_10').notNull(),\r\n latencyCount11: integer('latency_count_11').notNull(),\r\n latencyCount12: integer('latency_count_12').notNull(),\r\n latencyCount13: integer('latency_count_13').notNull(),\r\n latencyCount14: integer('latency_count_14').notNull(),\r\n latencyCount15: integer('latency_count_15').notNull(),\r\n latencyCount16: integer('latency_count_16').notNull(),\r\n latencyCount17: integer('latency_count_17').notNull(),\r\n latencyCount18: integer('latency_count_18').notNull(),\r\n latencyCount19: integer('latency_count_19').notNull(),\r\n latencyCount20: integer('latency_count_20').notNull(),\r\n latencyCount21: integer('latency_count_21').notNull(),\r\n latencyCount22: integer('latency_count_22').notNull(),\r\n latencyCount23: integer('latency_count_23').notNull(),\r\n latencyCount24: integer('latency_count_24').notNull(),\r\n latencyCount25: integer('latency_count_25').notNull(),\r\n latencyCount26: integer('latency_count_26').notNull(),\r\n latencyCount27: integer('latency_count_27').notNull(),\r\n latencyCount28: integer('latency_count_28').notNull(),\r\n latencyCount29: integer('latency_count_29').notNull(),\r\n latencyCount30: integer('latency_count_30').notNull(),\r\n latencyCount31: integer('latency_count_31').notNull(),\r\n latencyCount32: integer('latency_count_32').notNull(),\r\n latencyCount33: integer('latency_count_33').notNull(),\r\n latencyCount34: integer('latency_count_34').notNull(),\r\n latencyCount35: integer('latency_count_35').notNull(),\r\n latencyCount36: integer('latency_count_36').notNull(),\r\n latencyCount37: integer('latency_count_37').notNull(),\r\n latencyCount38: integer('latency_count_38').notNull(),\r\n latencyCount39: integer('latency_count_39').notNull(),\r\n latencyCount40: integer('latency_count_40').notNull(),\r\n latencyCount41: integer('latency_count_41').notNull(),\r\n latencyCount42: integer('latency_count_42').notNull(),\r\n latencyCount43: integer('latency_count_43').notNull(),\r\n latencyCount44: integer('latency_count_44').notNull(),\r\n latencyCount45: integer('latency_count_45').notNull(),\r\n latencyCount46: integer('latency_count_46').notNull(),\r\n latencyCount47: integer('latency_count_47').notNull(),\r\n latencyCount48: integer('latency_count_48').notNull(),\r\n latencyCount49: integer('latency_count_49').notNull(),\r\n\r\n // END\r\n});\r\n\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n\u003c!-- What happened, and why it was wrong -->\r\n\r\nSlow (2-3 second) TS validation time. This interferes with code-completion and makes for a bad DX.\r\n\r\n### 🙂 Expected behavior\r\n\r\n\u003c!-- What you expected to happen instead, and why -->\r\n\r\nType validation should stay performant.\r\n","author":{"url":"https://github.com/mhevery","@type":"Person","name":"mhevery"},"datePublished":"2023-07-09T21:05:18Z","url":"https://github.com/microsoft/TypeScript/issues/54939"}
| 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:6ef855c9-ab05-7018-cb4a-3c99a1f1c066 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D83A:B53AF:DBB90D:12547D9:6B01027E |
| html-safe-nonce | 5b4c3fb1792ee0e3f1751ab4b2ff2c1785b030ba817bb44b98f39d0ade3c48c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODNBOkI1M0FGOkRCQjkwRDoxMjU0N0Q5OjZCMDEwMjdFIiwidmlzaXRvcl9pZCI6IjUxMTQxODcyNTk1OTUyNjA1NDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 398a160d3d262e3cfbc128a8457365d2f0bb86f441125c513460da37173641b0 |
| hovercard-subject-tag | issue:1795563206 |
| 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/54939/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b50726ea53abe46b60469b67e4b2e48d43b4f7c1a06b228875d78ce2f57e3e8c/microsoft/TypeScript/issues/54939 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b50726ea53abe46b60469b67e4b2e48d43b4f7c1a06b228875d78ce2f57e3e8c/microsoft/TypeScript/issues/54939 |
| og:image:alt | Bug Report 🔎 Search Terms 🕗 Version & Regression Information This is a slow type verification leading to bad DX. ⏯ Playground Link Playground link with relevant code Related issue: drizzle-team/dri... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mhevery |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width