[17.3.x]: Patch port of new signal API access modifier enforcement#55070
Closed
devversion wants to merge 6 commits intoangular:17.3.xfrom
Closed
[17.3.x]: Patch port of new signal API access modifier enforcement#55070devversion wants to merge 6 commits intoangular:17.3.xfrom
devversion wants to merge 6 commits intoangular:17.3.xfrom
Conversation
Updates the function that parses initializer APIs to check any `Expression`, instead of expecting a class member. This will be useful for the upcoming changes.
…nd visibility This commit changes the TypeScript reflection host to: * inspect / process ES private fields. e.g. `#someField` — those are ignored right now and we would want to check them to issue diagnostics. * determine an access level of a class member. E.g. a member may be public, may be private, may be ES private, or public readonly. This can then be used in various checks later.
…r APIs An initializer API like `input`, `output`, or signal queries may not be compatible with certain access levels. E.g. queries cannot work with ES private class fields. This commit introduces a check for access levels into the initializer API recognition— enforcing that every initializer API *clearly* specifies what type of access is allowed.
…ivate fields This commit ensures that the new APIs like `input`, `model`, `output`, or signal-based queries are not accidentally used on fields that have a problematic visibility/access level that won't work. For example, queries defined using a private identifier (e.g. `#bla`) will not be accessible by the Angular runtime and therefore _dont_ work. This commit ensures: - `input` is only declared via public and protected fields. - `output` is only declared via public and protected fields. - `model` is only declared via public and protected fields. - signal queries are only declared via public, protected and TS private fields (`private` works, while `#bla` does not). Fixes angular#54863.
…nosticError` For `FatalDiagnosticError` we are currently hiding the `message` string field in favor of the actual TS `diagnosticMessage`. This works as expected, but makes these errors hard to debug in certain environments (e.g. Jasmine). That is because `null` is the value of `message` at runtime. We fix this by just overriding the type, like we originally intended to do. In addition, we properly render message chains in the `Error#message` field— so that these errors, when uncaught, are somewhat reasonable and can be useful.
…talDiagnosticError` Address feedback
crisbeto
approved these changes
Mar 27, 2024
Contributor
|
This PR was merged into the repository by commit 5b67c94. |
dylhunn
pushed a commit
that referenced
this pull request
Mar 28, 2024
…nd visibility (#55070) This commit changes the TypeScript reflection host to: * inspect / process ES private fields. e.g. `#someField` — those are ignored right now and we would want to check them to issue diagnostics. * determine an access level of a class member. E.g. a member may be public, may be private, may be ES private, or public readonly. This can then be used in various checks later. PR Close #55070
dylhunn
pushed a commit
that referenced
this pull request
Mar 28, 2024
…r APIs (#55070) An initializer API like `input`, `output`, or signal queries may not be compatible with certain access levels. E.g. queries cannot work with ES private class fields. This commit introduces a check for access levels into the initializer API recognition— enforcing that every initializer API *clearly* specifies what type of access is allowed. PR Close #55070
dylhunn
pushed a commit
that referenced
this pull request
Mar 28, 2024
…ivate fields (#55070) This commit ensures that the new APIs like `input`, `model`, `output`, or signal-based queries are not accidentally used on fields that have a problematic visibility/access level that won't work. For example, queries defined using a private identifier (e.g. `#bla`) will not be accessible by the Angular runtime and therefore _dont_ work. This commit ensures: - `input` is only declared via public and protected fields. - `output` is only declared via public and protected fields. - `model` is only declared via public and protected fields. - signal queries are only declared via public, protected and TS private fields (`private` works, while `#bla` does not). Fixes #54863. PR Close #55070
dylhunn
pushed a commit
that referenced
this pull request
Mar 28, 2024
…nosticError` (#55070) For `FatalDiagnosticError` we are currently hiding the `message` string field in favor of the actual TS `diagnosticMessage`. This works as expected, but makes these errors hard to debug in certain environments (e.g. Jasmine). That is because `null` is the value of `message` at runtime. We fix this by just overriding the type, like we originally intended to do. In addition, we properly render message chains in the `Error#message` field— so that these errors, when uncaught, are somewhat reasonable and can be useful. PR Close #55070
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Patch port of #54981