Skip to content

fix(migrations): normalize .d.ts paths in output migration field IDs - #71267

Merged
crisbeto merged 1 commit into
angular:mainfrom
irontaek:fix/output-migration-dts-id
Oct 14, 2026
Merged

crisbeto merged 1 commit into
angular:mainfrom
irontaek:fix/output-migration-dts-id

Conversation

@irontaek

@irontaek irontaek commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • The commit message follows Angular's guidelines.
  • Tests for the changes have been added (see below).
  • Docs have been added / updated (not applicable: no API change).

PR Type

  • Bugfix

What is the current behavior?

getUniqueIdForProperty in output-migration/output_helpers.ts tries to normalize declaration files to their source path, but drops the result:

const {id} = projectFile(prop.getSourceFile(), info);
id.replace(/\.d\.ts$/, '.ts');
return `${id}@@...`;

So an @Output() reached through a .d.ts (another compilation unit in batch mode) gets a different ClassFieldUniqueKey than the same output in its .ts source, and problematic usages recorded against the .d.ts key never meet the source declaration when unit data is merged.

The two sibling migrations already do this correctly:

  • signal-migration/src/utils/input_id.ts: const id = file.id.replace(/\.d\.ts$/, '.ts');
  • signal-queries-migration/field_tracking.ts: const id = projectFile(...).id.replace(/\.d\.ts$/, '.ts');

What is the new behavior?

The normalized path is assigned, matching the input and query migrations.

Tests

runTsurgeMigration runs a single program and (per its own TODO) has no batch/multi-unit mode, which is where the .d.ts key matters, so I didn't find a way to cover this in output-migration.spec.ts without new harness support. Happy to add a test if there's a preferred place for it.

Does this PR introduce a breaking change?

  • No

https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq

getUniqueIdForProperty called id.replace(/\.d\.ts$/, '.ts') and dropped
the result, so an @output seen through a .d.ts got a different ID than
the same output in its .ts source. The signal input and signal queries
migrations already assign the normalized ID.

Claude-Session: https://claude.ai/code/session_01W9Mk18mBNfkPfgg3hYweKq
@pullapprove
pullapprove Bot requested a review from atscott October 9, 2026 11:52
@angular-robot angular-robot Bot added the area: migrations Issues related to `ng update`/`ng generate` migrations label Oct 9, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 9, 2026
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Oct 9, 2026
@JeanMeche
JeanMeche removed the request for review from atscott October 9, 2026 20:02
@crisbeto
crisbeto merged commit baa916d into angular:main Oct 14, 2026
28 checks passed
@crisbeto

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: migrations Issues related to `ng update`/`ng generate` migrations target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants