Conversation
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
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.
When
strictInputAccessModifiersis disabled (the default, even withstrictTemplates), 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. forreadonlysignal 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?
What is the current behavior?
When
strictInputAccessModifiersis disabled (the default, even withstrictTemplates),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 thebinding 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.
readonlysignal 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/protectedfield 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?