Skip to content

fix(metadata): keep an optional-call signal query predicate as written - #612

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/signal-query-optional-call
Oct 22, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/signal-query-optional-call

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Follow-up to #602. That PR wraps a signal query predicate in forwardRef in setClassMetadata unless the predicate is a string or a call, like ngtsc's memberMetadataFromSignalQuery. But an optional call was still wrapped:

Predicate ngtsc 22.2.2 Oxc after #602 Now
viewChild(tokens?.get()) tokens?.get() i0.forwardRef(() => tokens?.get()) tokens?.get()
viewChild(tokens.get?.()) tokens.get?.() i0.forwardRef(() => tokens.get?.()) tokens.get?.()

TypeScript models a?.b() as a CallExpression, so ts.isCallExpression is true and ngtsc leaves it as written. oxc parses it as a ChainExpression, which the check missed. At runtime both forms resolve to the same value, so this changes only how the output reads.

A parenthesized or as-cast forwardRef(...) is not unwrapped; ngtsc wraps it again too (see the #602 thread).

Tests

  • tests/signal_query_metadata_forward_ref_test.rs: a new test for a plain call, a?.b() and a.b?.(). It fails without the change.
  • cargo test -p oxc_angular_compiler --all-features: 3499 passed.
  • Conformance: 1264/1264.
  • pnpm compare --fixtures: 1162 fixtures, 0 mismatches.
  • pnpm test: 376 passed.

🤖 Generated with Claude Code

`viewChild(a?.b())` stays as written in setClassMetadata, like a plain call:
`ts.isCallExpression` is true for an optional call, so ngtsc does not wrap it
in `forwardRef`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Brooooooklyn

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T13:59:09.233986Z e0b3138 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e0b3138bc9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Brooooooklyn
Brooooooklyn merged commit 1eed501 into main Oct 22, 2026
10 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/signal-query-optional-call branch October 22, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant