Skip to content

Remove extraneous declare in .d.ts output to better match strada#3729

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/remove-extraneous-declare
Draft

Remove extraneous declare in .d.ts output to better match strada#3729
Copilot wants to merge 2 commits intomainfrom
copilot/remove-extraneous-declare

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

The declare modifier is completely redundant in declaration files since everything is ambient by definition. This removes it from all .d.ts output, aligning with strada's behavior.

Changes

  • ensureModifierFlags: Added ModifierFlagsAmbient to the exclusion mask so it's always stripped, removed the needsDeclare-based addition logic
  • Synthetic declarations: Removed 4 inline if tx.needsDeclare blocks that conditionally added KindDeclareKeyword to generated variable statements
  • transformExpandoHost: Removed modifierFlags |= ast.ModifierFlagsAmbient for default export expando hosts

Before/After

-export declare const obj: { ... };
-declare function foo(): void;
+export const obj: { ... };
+function foo(): void;

Baseline impact

443 .diff baseline files deleted (output now matches strada reference).

The `declare` keyword is completely redundant in declaration files since
everything in a .d.ts file is already ambient by definition. This change
modifies the declaration emitter to never emit the `declare` modifier,
bringing the output closer to matching strada (443 .diff baselines removed).

Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/5bf355bd-1aa9-47c2-a656-133612fb14e3

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove extraneous declare in .d.ts output to better match strada Remove extraneous declare in .d.ts output to better match strada May 6, 2026
Copilot AI requested a review from RyanCavanaugh May 6, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove extraneous declare in .d.ts output to better match strada

2 participants