Title: Declaration emit drops non-identifier expando members of a `const` arrow function that also has identifier members · Issue #65596 · microsoft/TypeScript · GitHub
Open Graph Title: Declaration emit drops non-identifier expando members of a `const` arrow function that also has identifier members · Issue #65596 · microsoft/TypeScript
X Title: Declaration emit drops non-identifier expando members of a `const` arrow function that also has identifier members · Issue #65596 · microsoft/TypeScript
Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2 and main at 1ce7a28). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit and asked me to find real bugs and report ...
Open Graph Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2 and main at 1ce7a28). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit an...
X Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2 and main at 1ce7a28). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit an...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65596
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration emit drops non-identifier expando members of a `const` arrow function that also has identifier members","articleBody":"## TypeScript Version\n\nThe tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2 and `main` at 1ce7a284a). 6.0.3 is correct.\n\n## User Goal\n\nThe user maintains a fuzzer for TypeScript declaration emit and asked me to find real bugs and report them. This one was found by mapping which declaration-emit code past fixes touched, then probing that area.\n\n## Setup and Action\n\n```ts\n// lib.ts\nexport const handler = () => 0;\nhandler.retries = 3;\nhandler[\"x-request-id\"] = \"abc\";\n```\n\n```ts\n// use.ts\nimport { handler } from \"./out/lib.js\";\nconst id: string = handler[\"x-request-id\"];\n```\n\nRun `tsc --declaration --emitDeclarationOnly --strict --outDir out lib.ts`, then check `use.ts` against `out/lib.d.ts`.\n\n## Expected and Actual Behavior\n\n**What actually happened**: 7.x emits\n\n```ts\nexport declare function handler(): number;\nexport declare namespace handler {\n var retries: number;\n}\n```\n\n`\"x-request-id\"` is dropped without a diagnostic, and `use.ts` fails with `TS7053: Element implicitly has an 'any' type because expression of type '\"x-request-id\"' can't be used to index type 'typeof handler'`.\n\nThe same happens to numeric keys (`handler[3]`), unique symbol keys (`handler[sym]`), and names with spaces. With only non-identifier members (no `handler.retries`), 7.x keeps the object type and all members.\n\n**What I expected**: what 6.0.3 emits, which keeps every member:\n\n```ts\nexport declare const handler: {\n (): number;\n retries: number;\n \"x-request-id\": string;\n};\n```\n\n## Agent Info\n\nClaude Code + Claude Opus 5.5 + Skill Version 1.0\n","author":{"url":"https://github.com/ktfth","@type":"Person","name":"ktfth"},"datePublished":"2026-11-20T02:19:26Z","url":"https://github.com/microsoft/TypeScript/issues/65596"}
| 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:7a73e414-1225-25a8-d290-70470a37b985 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACA4:19E4BB:69BAC7:88E977:6B00E19A |
| html-safe-nonce | e2d2b0dd070caa55cf7458db266bad8eae51306ccf8c0ee4aa7bf845f75fc76c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0E0OjE5RTRCQjo2OUJBQzc6ODhFOTc3OjZCMDBFMTlBIiwidmlzaXRvcl9pZCI6Ijg1MTc4NzAzMDgxOTgyNDQ3NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3fa9f3eab792f9933969b5b10b4d83258a44927a60df66c2fe5101118234c2f4 |
| hovercard-subject-tag | issue:6503340485 |
| 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/65596/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81b79f7a5bf1f7f3f04b4e78fa1ff518dd66b80a54f2a44ba6697044ae4785fa/microsoft/TypeScript/issues/65596 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81b79f7a5bf1f7f3f04b4e78fa1ff518dd66b80a54f2a44ba6697044ae4785fa/microsoft/TypeScript/issues/65596 |
| og:image:alt | TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2 and main at 1ce7a28). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit an... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ktfth |
| 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