Skip to content

fix(language-service): resolve symbols for inputs with restricted access - #71139

Draft
aparzi wants to merge 1 commit into
angular:mainfrom
aparzi:fix-ls-restricted-input-symbols
Draft

aparzi wants to merge 1 commit into
angular:mainfrom
aparzi:fix-ls-restricted-input-symbols

Conversation

@aparzi

@aparzi aparzi commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

When strictInputAccessModifiers is disabled (the default, even with strictTemplates), bindings to input fields with restricted access (private/protected/readonly) are type-checked through a temporary variable rather than by assigning to the field directly. The type of this variable was generated as an indexed access type (typeof _t1)["fieldName"], which TypeScript does not treat as a reference to the class member. As a result, quick info, go to definition, find references and rename did not work for such inputs, e.g. for readonly signal inputs.

The type of the temporary variable is now generated as a type query with a qualified name, typeof _t1.fieldName, which TypeScript resolves as a regular reference to the class member. Reading a private/protected field through the type query is an access violation, so diagnostics are ignored for the type node, while the assignment into the temporary variable remains fully type-checked. The symbol builder now resolves the input symbol through the temporary variable's declaration instead of bailing out.

Fixes #58284

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When strictInputAccessModifiers is disabled (the default, even with strictTemplates),
bindings to input fields with restricted access (private/protected/readonly) are type-checked through a temporary variable typed with an indexed access type ((typeof _t1)["fieldName"]). TypeScript does not treat the string literal in an indexed access type as a reference to the class member, and the symbol builder bails out when the
binding target is a temporary variable. As a result, quick info, go to definition, find references and rename do not work for such inputs — e.g. readonly signal inputs.

Issue Number: #58284

What is the new behavior?

The temporary variable is now typed with a type query using a qualified name
(typeof _t1.fieldName), which TypeScript resolves as a regular reference to the class member, so references/rename work in both directions (template → class and class → template).
Reading a private/protected field through the type query would be an access violation, so diagnostics are ignored for the type node, while the assignment into the temporary variable remains fully type-checked. The symbol builder now resolves the input symbol through the temporary variable's declaration instead of bailing out.

Does this PR introduce a breaking change?

  • Yes
  • No

When `strictInputAccessModifiers` is disabled (the default, even with
`strictTemplates`), bindings to input fields with restricted access
(private/protected/readonly) are type-checked through a temporary
variable rather than by assigning to the field directly. The type of
this variable was generated as an indexed access type
`(typeof _t1)["fieldName"]`, which TypeScript does not treat as a
reference to the class member. As a result, quick info, go to
definition, find references and rename did not work for such inputs,
e.g. for `readonly` signal inputs.

The type of the temporary variable is now generated as a type query
with a qualified name, `typeof _t1.fieldName`, which TypeScript
resolves as a regular reference to the class member. Reading a
private/protected field through the type query is an access violation,
so diagnostics are ignored for the type node, while the assignment into
the temporary variable remains fully type-checked. The symbol builder
now resolves the input symbol through the temporary variable's
declaration instead of bailing out.

Fixes angular#58284
@angular-robot angular-robot Bot added the area: language-service Issues related to Angular's VS Code language service label Oct 2, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: language-service Issues related to Angular's VS Code language service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

readonly input are not highlighted by the language service

1 participant