Title: [bug:7.5.3] Mapper class explicite field regression · Issue #61540 · microsoft/TypeScript · GitHub
Open Graph Title: [bug:7.5.3] Mapper class explicite field regression · Issue #61540 · microsoft/TypeScript
X Title: [bug:7.5.3] Mapper class explicite field regression · Issue #61540 · microsoft/TypeScript
Description: 🔎 Search Terms Mapper class explicite inference for primitive 🕗 Version & Regression Information This changed between versions 5.7.3 and 5.6.3 ⏯ Playground Link PLAYGROUND if need, here is a very simple and epurate playground without all...
Open Graph Description: 🔎 Search Terms Mapper class explicite inference for primitive 🕗 Version & Regression Information This changed between versions 5.7.3 and 5.6.3 ⏯ Playground Link PLAYGROUND if need, here is a very s...
X Description: 🔎 Search Terms Mapper class explicite inference for primitive 🕗 Version & Regression Information This changed between versions 5.7.3 and 5.6.3 ⏯ Playground Link PLAYGROUND if need, here is a ve...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/61540
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[bug:7.5.3] Mapper class explicite field regression","articleBody":"### 🔎 Search Terms\n\nMapper class explicite inference for primitive\n\n### 🕗 Version & Regression Information\n\n- This changed between versions 5.7.3 and 5.6.3\n\n\n### ⏯ Playground Link\n\n[PLAYGROUND](https://www.typescriptlang.org/play/?ts=5.7.3#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXxhwmgCMIQAKeVALlWQFsSQZ4BKOx5mAWACh+IAB4AHHDAzwoJAM4YYUTPEhQZM+AEFZ8xZIDe-AJABtANYgAnjXhyYWVAHMAutfpMWRgMRbbugISuIABuLADc-AC+-PwqavAAKiBy8AZ8hiTIDvAAvNQgAO7K0HGphoYihCIsGBYAjDnwteFp5ZXVFgBMDYTE0uRUXWzNhhEUQ9FpiFhCDagFRarqpa04VRJ1nO6suU1GK2s1Xbk9pP3wg8Oj4wJpDOIgAEKZ9blzhbFLexWr7S+NUuowHg5MN9u0jgQiKdKOd2Jcxs0jHc4E8HBC3gs4sIMCBUMB1D4dEplt8DnUGvVVMpgRhQaTwd0oX0YRcjFdmlE+DUqvAALJQERrAA88QAfDlSmZ4PZ4OYLDhEAkXPAzAAaBJmJxODn8bkIfmClgdEXi7KS0zS-ByhUJAE2eT2LLY3H42XwAD8eRCrGspmVao1fu1kV1Fh5DAFawA+hksrkDcLEnJjAByWMppyi0LwAD0Ofg+XEFpl3pkuFo8AArAA6ABs1YAzKHw5GWFGpjN462YCKkhhUx2M1nc-nhFVMCBgPBrPT1rVrMYAESzmq1RfqtzcYN8PPwPf7+AAPXdzYQEcNMCjyJASYwfwTLF7yZT19RtSHzT18HP0evt4hD49reqavpkHQfqe37dh0MaZA0gHGsBaaZBBXJhme0HttM8HQU+-YpoOmahEAA)\n\nif need, here is a very simple and epurate playground without all the tests.\n[SMALL_PLAYGROUND](https://www.typescriptlang.org/play/?ts=5.7.3#code/MYewdgzgLgBAZgSwB4wLwzAUwO42AGwEMIIYBvAWACgBIGgBwCcR7NGoBPARgC4wBXALYAjNmhhcA3NTpMWbTgCZxi6bQC+ACgCUazqxgBZQvVaMAPABUAfGkq0A2gGsYCMDCeYOIODEsBdHidqdWpqfUwYQRMzAH1hfgBzcWNTNnMIn3hka0kYAHp8mGwQRhc3GAA3NggEcB4YAFYAOgA2ZoBmMKogA)\n### 💻 Code\n\nI have added some additional tests in order to gather more information and understand what is happening.\nBugs and fixes are the two adresse to verify.\n\n```ts\ndeclare function rollable( n:number ):number\n\nexport abstract class Abstract {\n\t[key: string]: number\n\t#Abstract!: never;\n}\n\nclass Test {\n\tbug = new class {\n\t\tproperty1 = 1;\n\t\tproperty2 = rollable( 2 );\n\t}();\n\n\tfix = new class {\n\t\tproperty1:number = 1;\n\t\tproperty2 = rollable( 2 );\n\t}();\n\n\tmoreBug1 = new class {\n\t\tproperty1 = 1 as const;\n\t\tproperty2 = rollable( 2 );\n\t}();\n\n\tmoreBug2 = new class extends Abstract {\n\t\tproperty1 = 1 as const;\n\t\tproperty2 = rollable( 2 );\n\t}();\n}\ntype Mapper\u003cT> ={\n\t[k in keyof T]: [k, T[k]];\n}\ntype Mapper2\u003cT> ={\n\t[k in keyof T as string extends k ? never : k]: [k, T[k]];\n}\ntype mapper_bug = Mapper\u003cTest['bug']>; // work in version: 5.6.3\ntype mapper_fix = Mapper\u003cTest['fix']>; // expected : property1: [\"property1\", number];\n// ^?\ntype mapper_moreTest1 = Mapper\u003cTest['moreBug1']>;\ntype mapper_moreTest2 = Mapper\u003cTest['moreBug2']>;\ntype mapper2_bug = Mapper2\u003cTest['bug']>;\ntype mapper2_fix = Mapper2\u003cTest['fix']>;\n```\n\n\n### 🙁 Actual behavior\n\nthe mapper ignore the field declaration !!\n\n### 🙂 Expected behavior\n\nthe mapper should consider the field declaration !\n\n### Additional information about the issue\n\nNo, but I just spent a whole day trying to understand before realizing that it's a TypeScript issue! I am exhausted.\n\n\n\n**please test the play ground in both version : 5.6.3 and 5.7.3**","author":{"url":"https://github.com/jonlepage","@type":"Person","name":"jonlepage"},"datePublished":"2025-04-06T16:07:18Z","url":"https://github.com/microsoft/TypeScript/issues/61540"}
| 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:dd257791-8101-894e-32a8-de3fc30c90ed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB40:311640:317AF9A:3EF6DB6:6B01D2AD |
| html-safe-nonce | b520f044d402a7942d7f4f11d069369009444e7205ac6f9a5109d72ec74edd78 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjQwOjMxMTY0MDozMTdBRjlBOjNFRjZEQjY6NkIwMUQyQUQiLCJ2aXNpdG9yX2lkIjoiMTEzMjAxMTk5MDY5NzQ5NzI2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 699c720e80ca285c5dc92c4d7236852d54e98edefe96b3d64e969a1cef9a4b59 |
| hovercard-subject-tag | issue:2975044938 |
| 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/61540/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f64b78fd5eb9c542e04cf5078ac34c87972ab2fd3ffe021d807d9f316ee3878e/microsoft/TypeScript/issues/61540 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f64b78fd5eb9c542e04cf5078ac34c87972ab2fd3ffe021d807d9f316ee3878e/microsoft/TypeScript/issues/61540 |
| og:image:alt | 🔎 Search Terms Mapper class explicite inference for primitive 🕗 Version & Regression Information This changed between versions 5.7.3 and 5.6.3 ⏯ Playground Link PLAYGROUND if need, here is a very s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonlepage |
| 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