Repository navigation
Conversation
…ngtsc ngtsc wraps a host value it can't evaluate in a WrappedNodeExpr and emits it in hostAttrs for a plain attribute; oxc rejected it. Values computed from an import are treated the same way, as ngtsc's local compilation mode does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Fixes #627 (case 1). Cases 2 and 3 in the issue are left unchanged on purpose. The issue explains why.
Problem
ngtsc's
evaluateHostExpressionBindings(compiler-cli/src/ngtsc/annotations/directive/src/shared.ts) turns a host value it can't evaluate (DynamicValue) intoWrappedNodeExpr(value.node).parseHostBindingsemits that expression for a plain attribute (hostAttrs: ["test", test]). oxc stored host attribute values as strings and reported an error. A value computed from an import got the "imported from another module" error instead, with or withoutresolveImportedValues.Fix
evaluate_host_metadatareturns aHostValuefor each entry: a string, or the expression ngtsc would emit. For a plain attribute, a dynamic value (an unknown name, a call, a function expression, or a value computed from an import) becomes its expression. The expression comes fromProp::origin, in the form it can be written where the metadata is compiled.HostMetadata.attributesholdsOutputExpressions, like the directive'sR3HostMetadata.attributesalready does. Full emit and partial emit (host: { attributes: { role: make() } }) both use them.[prop],(event),classandstylekeep ngtsc's "... binding must be string" errors, or the import error.{ ...ns }.Checks
host_metadata_evaluation_test:dynamic_value_of_a_plain_attributenow asserts the emittedhostAttrs. It coversmake(), an unknown name, a spread const, an import, and the ngtsc spec input. It used to assert the error.dynamic_value_of_a_plain_attribute_partialanddynamic_value_of_a_plain_attribute_out_of_scope.host_that_depends_on_an_importno longer expects an error for{ role: SHARED }.cross_file_values_test::dynamic_host_attribute_from_an_unreadable_importports ngtsc_spec.ts "should accept dynamic host attribute bindings" withresolveImportedValues.cargo test -p oxc_angular_compiler --all-features: 3519 passed, 0 failed, 1 ignored.cargo fmtis clean.cargo clippy -p oxc_angular_compiler --all-featuresreports no warnings on the changed lines.🤖 Generated with Claude Code