Skip to content

fix(compiler-cli): honor NoInfer on unbound model/signal inputs#69819

Open
LordKay-sudo wants to merge 2 commits into
angular:mainfrom
LordKay-sudo:fix/noinfer-model-inputs
Open

fix(compiler-cli): honor NoInfer on unbound model/signal inputs#69819
LordKay-sudo wants to merge 2 commits into
angular:mainfrom
LordKay-sudo:fix/noinfer-model-inputs

Conversation

@LordKay-sudo

Copy link
Copy Markdown
Contributor

Summary

  • Omit unbound signal/model inputs from the directive type constructor so 0 as any fillers no longer poison generic inference and defeat TypeScript's NoInfer (fixes Template type checker should respect NoInfer in generic component model inputs #69373).
  • Keep unbound plain inputs filled with 0 as any so generics like NgIf<T> still fall back to their default and template narrowing continues to work.
  • Add NoInfer model-input diagnostics coverage and a minimal NoInfer stub in the typecheck test lib.

Test plan

  • bazel test //packages/compiler-cli/src/ngtsc/typecheck/test:test
  • bazel test //packages/compiler-cli/test/ngtsc:ngtsc (ngIf narrowing filter)
  • CI green on this PR

Filling missing keys with `any` poisoned generic inference and defeated TypeScript's NoInfer on model/signal write types. Use Partial init types and only pass bound inputs.

Fixes angular#69373
Omitting all unbound inputs broke NgIf generic inference and template
narrowing. Keep 0-as-any fillers for plain inputs; omit only unbound
signal/model inputs so NoInfer still works.
@pullapprove
pullapprove Bot requested a review from JoostK July 16, 2026 12:30
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 16, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jul 16, 2026
@JoostK

JoostK commented Jul 16, 2026

Copy link
Copy Markdown
Member

This mostly races with #57724 (closed as out-of-date, may be revised, but as mentioned is a breaking change). It's not clear to me why this differentiates behavior between signal vs non-signal types, that seems undesirable.

@LordKay-sudo

LordKay-sudo commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I agree that the signal/non-signal distinction is undesirable.

There is no principled type-system reason those should behave differently in the type constructor. The distinction was only a scoped workaround: the split came from narrowing the initial implementation after omitting all unbound inputs via Partial regressed NgIf generic narrowing. That fixed #69373 without immediately pulling in the broader omitted-input breakage surface, but it special-cases input kind rather than fixing inference uniformly, so I agree it shouldn't land as a long-term design.

I tested two unified alternatives locally before replying:

So I don't think the signal-only version should land as-is. Would you prefer that I rework this as part of the broader #57724 approach (potentially behind a flag), or close this PR in favor of revising #57724?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template type checker should respect NoInfer in generic component model inputs

2 participants