Title: Unbound type parameter in declaration files for accessors with divergent types. · Issue #61391 · microsoft/TypeScript · GitHub
Open Graph Title: Unbound type parameter in declaration files for accessors with divergent types. · Issue #61391 · microsoft/TypeScript
X Title: Unbound type parameter in declaration files for accessors with divergent types. · Issue #61391 · microsoft/TypeScript
Description: 🔎 Search Terms type parameter accessor declaration different types 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 ⏯ Playground Link Playground Link 💻 Code function makeV() { type X
Open Graph Description: 🔎 Search Terms type parameter accessor declaration different types 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 ⏯ Playground Link Playground Link 💻 Code function mak...
X Description: 🔎 Search Terms type parameter accessor declaration different types 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 ⏯ Playground Link Playground Link 💻 Code function...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/61391
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unbound type parameter in declaration files for accessors with divergent types.","articleBody":"### 🔎 Search Terms\n\ntype parameter accessor declaration different types\n\n### 🕗 Version & Regression Information\n\n- This changed between versions 5.2 and 5.3\n\n### ⏯ Playground Link\n\n[Playground Link](https://www.typescriptlang.org/play/?ts=5.3.3#code/FAMwrgdgxgLglgewgAgLYEMDWBTAagCgEpkBvYZZGATwAdtkANAHgBUA+ZAXlOQHNsYyACZJsRAFzIQ6ADYBnegB9kLANzIFgkRDEA3SS2TKIYGTOIBfcsgBOAsDZQmzAQmTo5jJidQAjbDZswFbA2AAeNAg2glBIcoK6XGhYeESqwEA)\n\n### 💻 Code\n\n```ts\nfunction makeV() {\n type X\u003cT> = { get done(): false | T; set done(v: T | null) }\n return null! as X\u003cnumber>\n}\nexport const v = makeV();\n```\n\n\n### 🙁 Actual behavior\n\nCorrect declaration files are generated for accessors that have divergent read/write types.\n\n### 🙂 Expected behavior\n\n`d.ts` keeps type parameter in type for `v`:\n\n```ts\nexport declare const v: {\n get done(): false | T;\n set done(v: T | null);\n};\n```\n\n### Additional information about the issue\n\nSeems to have not worked since 5.3 when divergent property types were first preserved in declaration files. Discovered while investigating #60864 ","author":{"url":"https://github.com/dragomirtitian","@type":"Person","name":"dragomirtitian"},"datePublished":"2025-03-10T15:25:29Z","url":"https://github.com/microsoft/TypeScript/issues/61391"}
| 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:943b4a7b-a38f-a9de-1732-41c1031fabcb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8A4:16EED3:316F0B2:3EFF916:6B01D380 |
| html-safe-nonce | 56d161cb080e7dc1db1fbd59b1f75e014c8b3f85d8ab0ec3d041a78b0d148486 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEE0OjE2RUVEMzozMTZGMEIyOjNFRkY5MTY6NkIwMUQzODAiLCJ2aXNpdG9yX2lkIjoiNDE5MjIzMzg0MDQ0MzUxMTY4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 97a17605998010e2c0656d045c54bd1c1b681b39b286267d2dc590494bc9eae8 |
| hovercard-subject-tag | issue:2907645930 |
| 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/61391/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d1da84d047924ca6c99a4ab1bb5c9852d2ef5a590b3f4d6a654903955be96af/microsoft/TypeScript/issues/61391 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d1da84d047924ca6c99a4ab1bb5c9852d2ef5a590b3f4d6a654903955be96af/microsoft/TypeScript/issues/61391 |
| og:image:alt | 🔎 Search Terms type parameter accessor declaration different types 🕗 Version & Regression Information This changed between versions 5.2 and 5.3 ⏯ Playground Link Playground Link 💻 Code function mak... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dragomirtitian |
| 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