New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(compiler): add support for safe calls in templates #44580
Closed
Closed
+414
−77
Conversation
This file contains 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
crisbeto
reviewed
Dec 30, 2021
03b500a
to
8f34d6a
alxhub
approved these changes
Jan 4, 2022
| template: ` | ||
| <span [title]="'Your last name is ' + (person.getLastName?.() ?? 'unknown')"> | ||
| Hello, {{ person.getName?.() }}! | ||
| You are a Balrog: {{ person.getSpecies?.()?.()?.()?.()?.() || 'unknown' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shall not pass (but the test should).
JoostK
reviewed
Jan 6, 2022
packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts
Outdated
Show resolved
Hide resolved
crisbeto
reviewed
Jan 7, 2022
packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts
Outdated
Show resolved
Hide resolved
crisbeto
added a commit
to crisbeto/angular
that referenced
this issue
Jan 7, 2022
…y read This was flagged during the code review of angular#44580. When generating a type check block, we were interpreting any call to `$any` as an `as any` cast, even if it's part of a `PropertyRead` (e.g. `foo.$any(1)`). This is handled correctly in other parts of the compiler, but it looks like it was missed in the type checker.
atscott
added a commit
that referenced
this issue
Jan 7, 2022
…y read (#44657) This was flagged during the code review of #44580. When generating a type check block, we were interpreting any call to `$any` as an `as any` cast, even if it's part of a `PropertyRead` (e.g. `foo.$any(1)`). This is handled correctly in other parts of the compiler, but it looks like it was missed in the type checker. PR Close #44657
atscott
added a commit
that referenced
this issue
Jan 7, 2022
…y read (#44657) This was flagged during the code review of #44580. When generating a type check block, we were interpreting any call to `$any` as an `as any` cast, even if it's part of a `PropertyRead` (e.g. `foo.$any(1)`). This is handled correctly in other parts of the compiler, but it looks like it was missed in the type checker. PR Close #44657
|
All the feedback should be addressed now. Setting to blocked until #44447 is merged in. |
Adds support for safely calling functions that may be undefined inside template expressions. E.g. `maybeUndefined?.()` Fixes angular#42298.
|
Rebased on top of #44447. Unblocking. |
|
This PR was merged into the repository by commit a4ab6d6. |
ramthir
added a commit
to ramthir/angular
that referenced
this issue
Jan 13, 2022
Adds support for safely calling functions that may be undefined inside template expressions. E.g. `maybeUndefined?.()` Fixes angular#42298. PR Close angular#44580
amitbeck
added a commit
to amitbeck/angular
that referenced
this issue
Jan 13, 2022
…y read (angular#44657) This was flagged during the code review of angular#44580. When generating a type check block, we were interpreting any call to `$any` as an `as any` cast, even if it's part of a `PropertyRead` (e.g. `foo.$any(1)`). This is handled correctly in other parts of the compiler, but it looks like it was missed in the type checker. PR Close angular#44657
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.


Adds support for safely calling functions that may be undefined inside template expressions. E.g.
maybeUndefined?.()Fixes #42298.
The text was updated successfully, but these errors were encountered: