Skip to content

[PATCH] refactor: add explicit types for exports relying on inferred call return type#61316

Closed
josephperrott wants to merge 1 commit intoangular:19.2.xfrom
josephperrott:patch-for-61312
Closed

[PATCH] refactor: add explicit types for exports relying on inferred call return type#61316
josephperrott wants to merge 1 commit intoangular:19.2.xfrom
josephperrott:patch-for-61312

Conversation

@josephperrott
Copy link
Copy Markdown
Member

No description provided.

…urn type

As part of the Bazel toolchain migration we noticed that implicit types
generated by the TypeScript compiler sometimes end up referencing types
from other packages (i.e. cross-package imports).

These imports currently work just because the Bazel `ts_library` and
`ng_module` rules automatically inserted a `<amd-module
name="@angular/x" />` into `.d.ts` of packages. This helped TS figure
out how to import a given file. Notably this is custom logic that is not
occuring in vanilla TS or Angular compilations—so we will drop this
magic as part of the toolchain cleanup!

To improve code quality and keep the existing behavior working, we are
doing the following:

- adding a lint rule that reduces the risk of such imports breaking. The
  failure scenario without the rule is that API goldens show unexpected
  diffs, and types might be duplicated in a different package!

- keeping the `<amd-module` headers, but we manually insert them into
  the package entry-points. This should ensure we don't regress
  anywhere; while we also improved general safety around this above.

Long-term, isolated declarations or a lint rule from eslint-typescript
can make this even more robust.
@josephperrott josephperrott requested a review from devversion May 13, 2025 20:21
@josephperrott josephperrott added action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project target: patch This PR is targeted for the next patch release labels May 13, 2025
@ngbot ngbot bot added this to the Backlog milestone May 13, 2025
@ngbot ngbot bot added this to the Backlog milestone May 13, 2025
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed labels May 13, 2025
@angular-robot angular-robot bot removed the area: build & ci Related the build and CI infrastructure of the project label May 13, 2025
@ngbot ngbot bot removed this from the Backlog milestone May 13, 2025
@josephperrott josephperrott added PullApprove: disable and removed requires: TGP This PR requires a passing TGP before merging is allowed labels May 13, 2025
@josephperrott
Copy link
Copy Markdown
Member Author

This PR was merged into the repository by commit 899cb4a.

The changes were merged into the following branches: 19.2.x

josephperrott pushed a commit that referenced this pull request May 13, 2025
…urn type (#61316)

As part of the Bazel toolchain migration we noticed that implicit types
generated by the TypeScript compiler sometimes end up referencing types
from other packages (i.e. cross-package imports).

These imports currently work just because the Bazel `ts_library` and
`ng_module` rules automatically inserted a `<amd-module
name="@angular/x" />` into `.d.ts` of packages. This helped TS figure
out how to import a given file. Notably this is custom logic that is not
occuring in vanilla TS or Angular compilations—so we will drop this
magic as part of the toolchain cleanup!

To improve code quality and keep the existing behavior working, we are
doing the following:

- adding a lint rule that reduces the risk of such imports breaking. The
  failure scenario without the rule is that API goldens show unexpected
  diffs, and types might be duplicated in a different package!

- keeping the `<amd-module` headers, but we manually insert them into
  the package entry-points. This should ensure we don't regress
  anywhere; while we also improved general safety around this above.

Long-term, isolated declarations or a lint rule from eslint-typescript
can make this even more robust.

PR Close #61316
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue 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 Jun 13, 2025
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 PullApprove: disable target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants