-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor: allow coercion inputs to work with async pipe #17640
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
The head ref may contain hidden characters: "refactor/coercion-inputs-accept-nu\u00C3ll-undefined"
refactor: allow coercion inputs to work with async pipe #17640
Conversation
e4c81ca
to
711350d
Compare
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.
LGTM
|
||
if (node.type.kind === ts.SyntaxKind.AnyKeyword) { | ||
// if the type is "any", then it can be "null" and "undefined" too. | ||
return; |
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.
Do we want to allow it to be any
? Since it's something we control it might make sense to be a bit more strict.
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.
Some coercion members are set to any
. i.e. the value input for mat-input's because otherwise value
would only accept string while datepicker input accepts a date too.
So any
is a special case that we allow.
We need to accept `null` and `undefined` for coercion members to make them work with the `async` pipe. The overall problem remains for other non-coercion inputs, but since the majority of inputs are coerced, we only make the change to these. The overall problem applies to _all_ inputs, but it's not clear yet how this issue can be solved for all inputs. This involves discussion with the framework team. More information: https://hackmd.io/@devversion/rkKOD8ZjB
711350d
to
e6f3619
Compare
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.
LGTM
We could consider adding type aliases so that we don't repeat |
@mmalerba Sounds like a good idea to me. We can do that as a follow-up if we all think it's reasonable. I'd be happy to switch to that. |
Follow-up PR would be good |
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. |
We need to accept
null
andundefined
for coercion membersto make them work with the
async
pipe. The overall problemremains for other non-coercion inputs, but since the majority
of inputs are coerced, we only make the change to these.
The overall problem applies to all inputs, but it's not clear
yet how this issue can be solved for all inputs. This involves
discussion with the framework team.
More information: https://hackmd.io/@devversion/rkKOD8ZjB