Remove extraneous declare in .d.ts output to better match strada#3729
Draft
Remove extraneous declare in .d.ts output to better match strada#3729
declare in .d.ts output to better match strada#3729Conversation
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
Remove extraneous May 6, 2026
declare in .d.ts output to better match stradadeclare in .d.ts output to better match strada
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
declaremodifier is completely redundant in declaration files since everything is ambient by definition. This removes it from all.d.tsoutput, aligning with strada's behavior.Changes
ensureModifierFlags: AddedModifierFlagsAmbientto the exclusion mask so it's always stripped, removed theneedsDeclare-based addition logicif tx.needsDeclareblocks that conditionally addedKindDeclareKeywordto generated variable statementstransformExpandoHost: RemovedmodifierFlags |= ast.ModifierFlagsAmbientfor default export expando hostsBefore/After
Baseline impact
443
.diffbaseline files deleted (output now matches strada reference).