Title: Declaration emit drops the normalized optional properties of a union of object literals (`retries?: undefined`) · Issue #65571 · microsoft/TypeScript · GitHub
Open Graph Title: Declaration emit drops the normalized optional properties of a union of object literals (`retries?: undefined`) · Issue #65571 · microsoft/TypeScript
X Title: Declaration emit drops the normalized optional properties of a union of object literals (`retries?: undefined`) · Issue #65571 · microsoft/TypeScript
Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2). 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 them. This one was f...
Open Graph Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit and asked me to find r...
X Description: TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit and asked me to find r...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65571
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration emit drops the normalized optional properties of a union of object literals (`retries?: undefined`)","articleBody":"## TypeScript Version\n\nThe tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2). 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 checking that an emitted `.d.ts` describes the same types as its source.\n\n## Setup and Action\n\n```ts\n// settings.ts\nexport const settings = {\n mode: Math.random() > 0.5 ? { fast: true } : { retries: 3 },\n};\n```\n\n```ts\n// consumer.ts\nimport { settings } from \"./settings\";\nexport const retries = settings.mode.retries;\n```\n\nRun `tsc --declaration --emitDeclarationOnly --strict settings.ts` and inspect `settings.d.ts`. Then compile `consumer.ts` against the emitted `settings.d.ts` instead of `settings.ts`.\n\n## Expected and Actual Behavior\n\n**What actually happened**: 7.x emits\n\n```ts\nexport declare const settings: {\n mode: {\n fast: boolean;\n } | {\n retries: number;\n };\n};\n```\n\n`consumer.ts` compiles against `settings.ts`, but against the emitted declaration it fails with `TS2339: Property 'retries' does not exist on type '{ fast: boolean; } | { retries: number; }'`.\n\n**What I expected**: the declared type of `settings` keeps the normalized optional properties, as 6.0.3 emits:\n\n```ts\nexport declare const settings: {\n mode: {\n fast: boolean;\n retries?: undefined;\n } | {\n retries: number;\n fast?: undefined;\n };\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-18T23:44:59Z","url":"https://github.com/microsoft/TypeScript/issues/65571"}
| 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:13aed415-34ca-8d63-c172-37eca35f8e5a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B29E:1F44:1C40DF:2555AE:6B00E0FC |
| html-safe-nonce | a4029db051a22f2c805360573ea29843c87c6634ab822d76597ad24fe21d9ceb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjlFOjFGNDQ6MUM0MERGOjI1NTVBRTo2QjAwRTBGQyIsInZpc2l0b3JfaWQiOiI1ODkxMTUyMjIwNzQwNzA2NTU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 02734f360beaa4ce21f176adc32937d0a89e56ba20d1d612738a595b28ff3b66 |
| hovercard-subject-tag | issue:6479063230 |
| 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/65571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8c0dd00c504ca270ecf154f19d0a0c7dbf754f4e60aa24ff1e298f412324a8a/microsoft/TypeScript/issues/65571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8c0dd00c504ca270ecf154f19d0a0c7dbf754f4e60aa24ff1e298f412324a8a/microsoft/TypeScript/issues/65571 |
| og:image:alt | TypeScript Version The tested TypeScript version is 7.1.0-dev.20261118.1 (also 7.0.2). 6.0.3 is correct. User Goal The user maintains a fuzzer for TypeScript declaration emit and asked me to find r... |
| 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