Skip to content

fix(compiler): report missing ngtsc diagnostics for inputs, outputs, queries and signal APIs - #559

Merged
Brooooooklyn merged 3 commits into
mainfrom
fix/issue-508-missing-diagnostics
Oct 8, 2026
Merged

Brooooooklyn merged 3 commits into
mainfrom
fix/issue-508-missing-diagnostics

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Fixes #508.

Implements the ngtsc diagnostics the issue lists, matching vendored Angular 22.0.0 semantics (ngtsc/annotations/directive/src/shared.ts, initializer_function_access.ts, input_output_parse_options.ts, ngtsc/validation/src/rules/initializer_api_usage_rule.ts).

Diagnostics added

Code Trigger Message
NG8110 initializer API call outside a @Component/@Directive member initializer Unsupported call to the {fn} function. This function can only be called in the initializer of a class member. (or the …initializer of a property on a @Component or @Directive class. variant)
NG1053 signal input/model/output/query on private/#private member Cannot use "{fn}" on a class member that is declared as {level}. + allowed-levels chain
NG1010 non-literal signal alias / non-object options arg Alias needs to be a string that is statically analyzable. / Argument needs to be an object literal that is statically analyzable.
NG1054 duplicate input/output binding name `Input
NG1006 multiple query decorators / @Input + query decorator Cannot combine multiple query decorators. / Cannot combine @Input decorators with query decorators
NG2004 @Directive({selector: ''}) Directive {D} has no selector, please add it!
NG1010 non-string selector (component and directive) selector must be a string + wrong-type suffix

Behavior changes

  • @Output on a setter/getter/method now emits its outputs entry (@Output() set o(v) → outputs:{o:"o"}).
  • Members with unreflectable names (computed ['k'], numeric 0:) are skipped in io/query passes and emit paths, matching upstream reflectClassMember; #x members keep their checks.
  • Check ordering mirrors upstream throw order (signal access/options errors before decorator collisions; duplicate-binding before static for inputs, after for outputs; decorator collisions before the member-kind query check).

Upstream quirks preserved

  • (input(0)) and input(0) as any escape NG8110 entirely; input(0)! and satisfies trigger it.
  • Callee resolution uses oxc_semantic, so a local/param shadowing input or a core namespace doesn't false-positive.
  • @In (aliased import) doesn't trigger the @Input-query collision; the written name must be Input.
  • alias: LOCAL_CONST errors — the options object isn't evaluated for signal APIs.

Verified

  • cargo test -p oxc_angular_compiler --all-features — all pass (incl. new regression tests for each diagnostic and edge case)
  • cargo run -p oxc_angular_conformance — Total: 1264/1264 (100.0%)
  • pnpm test in napi/angular-compiler — 401/401
  • cargo fmt --all -- --check clean; no new clippy warnings

…queries and signal APIs

Implements the ngtsc diagnostics issue #508 lists (vendored Angular
22.0.0 semantics):

- NG8110 source-file rule for initializer APIs used outside a class
  member initializer (new src/validation.rs), incl. upstream quirks:
  parens/`as` wrapping escapes the check, `!`/`satisfies` trigger it,
  `.required` shows in the message, and callee identifiers are resolved
  through oxc_semantic so shadowed locals and params do not
  false-positive.
- NG1053 disallowed member visibility (private / ES private) for
  signal input/model/output/query initializers; queries keep allowing
  TS `private`.
- NG1010 for signal options: a non-literal `alias` and a non-object
  options argument.
- NG1054 duplicate input/output binding names, with the first binding
  labeled as related.
- NG1006 for combining multiple query decorators or a query decorator
  with an `@Input`-named decorator.
- NG2004 `selector: ''` on @directive; `selector must be a string` for
  both components and directives.
- `@Output` on setters/getters/methods now emits its `outputs` entry.
- Members whose names can't be reflected (computed/numeric keys) are
  skipped in the io/query passes and emit paths like upstream's
  reflectClassMember; `#x` members keep their checks.

Existing checks were reordered where upstream throws them in a
different sequence (signal access/options errors before decorator
collisions, duplicate-binding before static for inputs but after for
outputs, decorator collisions before the member-kind query check).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 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-08T03:43:18.008611Z f933d8d New commits
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0001908c9e

ℹ️ 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".

Comment thread crates/oxc_angular_compiler/src/validation.rs Outdated
…odel

The class-decorator check still used the file-wide import map, so a
shadowed `Directive` identifier (e.g. a function parameter) counted as
Angular's and suppressed the diagnostic. Resolve the decorator callee
to its binding like `is_api_reference` does for the call, matching
upstream's `decorator.import?.from`.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7b1204514

ℹ️ 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".

Comment thread crates/oxc_angular_compiler/src/directive/property_decorators.rs
`extract_view_queries_in`/`extract_content_queries_in` still named
members with `get_property_key_name`, which accepts a string-literal
key on a computed member — `['q'] = viewChild('x')` emitted a query
while the new member guards skip validation for it. Use
`member_name_ident` (the reflectClassMember-equivalent) in every
extraction arm so computed and numeric members produce no query.
@Brooooooklyn
Brooooooklyn merged commit f7c2a73 into main Oct 8, 2026
9 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/issue-508-missing-diagnostics branch October 8, 2026 03:54
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.

Missing ngtsc diagnostics for invalid inputs, outputs, queries and signal APIs

1 participant