Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

refactor(compiler): support matching template elements to foreign components#68674

Closed
leonsenft wants to merge 3 commits into
angular:mainangular/angular:mainfrom
leonsenft:foreign-componentleonsenft/angular:foreign-componentCopy head branch name to clipboard
Closed

refactor(compiler): support matching template elements to foreign components#68674
leonsenft wants to merge 3 commits into
angular:mainangular/angular:mainfrom
leonsenft:foreign-componentleonsenft/angular:foreign-componentCopy head branch name to clipboard

Conversation

@leonsenft

@leonsenft leonsenft commented May 11, 2026

Copy link
Copy Markdown
Contributor

We extract the identifier name from the foreignImports expression in ComponentDecoratorHandler and use a SelectorlessMatcher to match element tags against these names. If an element matches both a regular Angular directive and a foreign component, a conflict error is thrown.

In addition, we implement strict template semantic validation for these matched foreign components within TemplateSemanticsChecker. Elements matched as foreign components only support static attributes and property bindings. Any event bindings, template references, or non-property input bindings (e.g. class, style, or attribute bindings) trigger a semantic error diagnostic.

Finally, we skip standard DOM schema checks for foreign components to prevent spurious validation errors since foreign components are not defined in standard HTML schemas.

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels May 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 11, 2026
@leonsenft leonsenft added the target: patch This PR is targeted for the next patch release label May 11, 2026
@leonsenft leonsenft force-pushed the foreign-component branch 6 times, most recently from 195733b to 94cf03f Compare May 18, 2026 21:09
@leonsenft leonsenft removed the detected: feature PR contains a feature commit label May 18, 2026
…s in templates

We extract the identifier name from the `foreignImports` expression in
`ComponentDecoratorHandler` and use a `SelectorlessMatcher` to match element
tags against these names. If an element matches both a regular Angular
directive and a foreign component, a conflict error is thrown.

In addition, we implement strict template semantic validation for these matched
foreign components within `TemplateSemanticsChecker`. Elements matched as
foreign components only support static attributes and property bindings. Any
event bindings, template references, or non-property input bindings (e.g.
class, style, or attribute bindings) trigger a semantic error diagnostic.

Finally, we skip standard DOM schema checks for foreign components to prevent spurious
validation errors since foreign components are not defined in standard HTML schemas.
@leonsenft leonsenft force-pushed the foreign-component branch from 94cf03f to b22195c Compare May 18, 2026 21:40
@leonsenft leonsenft requested review from JeanMeche and atscott May 18, 2026 21:43
@leonsenft leonsenft marked this pull request as ready for review May 18, 2026 21:43
@leonsenft leonsenft added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels May 18, 2026
Comment thread packages/compiler-cli/src/ngtsc/typecheck/src/checker.ts Outdated
@pullapprove pullapprove Bot requested a review from JeanMeche May 19, 2026 12:00
Comment thread packages/compiler-cli/src/ngtsc/metadata/src/util.ts Outdated
@pullapprove pullapprove Bot requested a review from atscott May 19, 2026 16:56
Correctly matches and resolves foreign components when imported under an alias
name inside the component file.
@pullapprove pullapprove Bot requested a review from atscott May 19, 2026 18:15
@leonsenft

Copy link
Copy Markdown
Contributor Author

g3 failure is unrelated

@leonsenft leonsenft added the action: merge The PR is ready for merge by the caretaker label May 19, 2026
@ngbot

ngbot Bot commented May 19, 2026

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing
    pending status "pullapprove" is pending
    pending 2 pending code reviews

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@leonsenft

Copy link
Copy Markdown
Contributor Author

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

@leonsenft leonsenft closed this in d596d8b May 19, 2026
leonsenft added a commit that referenced this pull request May 19, 2026
Correctly matches and resolves foreign components when imported under an alias
name inside the component file.

PR Close #68674
@leonsenft leonsenft deleted the foreign-component branch May 19, 2026 20:42
@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 Jun 19, 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: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.