Title: Preserve computed property in `--isolatedDeclarations` emit · Issue #61892 · microsoft/TypeScript · GitHub
Open Graph Title: Preserve computed property in `--isolatedDeclarations` emit · Issue #61892 · microsoft/TypeScript
X Title: Preserve computed property in `--isolatedDeclarations` emit · Issue #61892 · microsoft/TypeScript
Description: 🔍 Search Terms isolated declarations, computed properties ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior of existing JavaScript code This could be...
Open Graph Description: 🔍 Search Terms isolated declarations, computed properties ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior o...
X Description: 🔍 Search Terms isolated declarations, computed properties ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime be...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/61892
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Preserve computed property in `--isolatedDeclarations` emit","articleBody":"### 🔍 Search Terms\n\nisolated declarations, computed properties\n\n### ✅ Viability Checklist\n\n- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\n- [x] This wouldn't change the runtime behavior of existing JavaScript code\n- [x] This could be implemented without emitting different JS based on the types of the expressions\n- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)\n- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types\n- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals\n\n### ⭐ Suggestion\n\nNow that #60052 allows for (some) computed properties in in `.d.ts` files I think the next step is for `--isolatedDeclaration` to be updated to not error and to emit the computed properties. Opening this issue if helpful to track this work.\n\nI believe the previous plan (#58800) to introduce a new syntactic marker is no longer required.\n\nRelated issues: #58533 #60818 #61068\n\n### 📃 Motivating Example\n\n```ts\nexport const prop: unique symbol = Symbol();\n\nexport class MyClass {\n [prop] = () =\u003e Math.random();\n}\n```\n\n### `@isolatedDeclarations: false`\n\n[playground](https://www.typescriptlang.org/play/?isolatedDeclarations=false\u0026ts=5.8.3#code/PTAEAEEsGcHsBsCGAXApgEwCKoMZIE4qSwB20AXKAGaLzSoBQqAHgA6z7Kg6nRev5YrSgFcSkAI4jUoaAE8AtgCMEoALygAyopXwAFAEoA3AyZsOXPImjRQAWTkBhJDdABvBqC+gA2gKEAuuqghuoAfPYoABYAdIQk6LAKhiYAvgxAA)\n\n```ts\nexport declare const prop: unique symbol;\nexport declare class MyClass {\n [prop]: () =\u003e number;\n}\n```\n\n### `@isolatedDeclarations: true` (current 🙁)\n\n[playground](https://www.typescriptlang.org/play/?isolatedDeclarations=true\u0026ts=5.8.3#code/PTAEAEEsGcHsBsCGAXApgEwCKoMZIE4qSwB20AXKMvgK6oBQqAHgA6z7Kg6nScv6wWlGiUgBHOqGgBPALYAjBKAC8oAMpzF8ABQBKANz1GrdpzyJo0UAFlpAYSSXQAb3qh3oANr9BAXRWgeioAfDYoABYAdIQk6LCyeoYAvvRAA)\n\n```sh\nts(9038) Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.\n```\n\n```ts\nexport declare const prop: unique symbol;\nexport declare class MyClass {\n}\n```\n\n### `@isolatedDeclarations: true` (future 🚀 )\n\nNo error and same emit as `@isolatedDeclarations: false`\n\n```ts\nexport declare const prop: unique symbol;\nexport declare class MyClass {\n [prop]: () =\u003e number;\n}\n```\n\n### 💻 Use Cases\n\nThe primary use case is enabling isolated declarations at scale on large codebases that make heavy use of computed properties.\n","author":{"url":"https://github.com/acutmore","@type":"Person","name":"acutmore"},"datePublished":"2025-06-18T14:05:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/61892/TypeScript/issues/61892"}
| 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:021eeb2f-7a85-eca7-606b-61271f705924 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1FC:1D31DF:BF2054:FFF825:6A611B05 |
| html-safe-nonce | 56cb5809703a02450611b243a04758bc7fb1a3e2efc43cef0a431013b2477253 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUZDOjFEMzFERjpCRjIwNTQ6RkZGODI1OjZBNjExQjA1IiwidmlzaXRvcl9pZCI6IjkzNTcxNTk1NjQ0MTgxNTgxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 621f5fd7e9aedc90fd9bff1a124d1d4f997a86c9192b22d987520f0a5d6a4e78 |
| hovercard-subject-tag | issue:3157030278 |
| 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/61892/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c41fe65624bd01d281a56c440c982c2dbf1e317fd00453804344ae67056b5a34/microsoft/TypeScript/issues/61892 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c41fe65624bd01d281a56c440c982c2dbf1e317fd00453804344ae67056b5a34/microsoft/TypeScript/issues/61892 |
| og:image:alt | 🔍 Search Terms isolated declarations, computed properties ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | acutmore |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5d23cf1c0cd2fa53870b9a743b3e1bc3ff0d0b0b3a477b50251e1c9dd8ecb93d |
| 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 | abf5a2f79ab9b533c5865f5281057f7d17cf18f3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width