Support for constructor property promotion on events - improves autocompletion and static analyzer support #216
gehrisandro
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
|
Right now you can do |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I personally would love to see something like this. I've had it backfire so much at me that I eventually I never used the ::fire or ::commit syntax. Not really a fan of the magic. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The current behaviour when firing an event is to provide named parameters, but there is no autocompletion which helps to find the correct parameter names as the "magic"
fire()does not have any information about the properties available in the event.What I currently do is to use "Constructor property promotion" to specify the arguments and then have a
firemethod on the event to fire the event after creation via the constructor.This is how the change looks like when firing an event:
The benefit is to have autocompletion available and support for static analysers.
What it technically needs is a
__callimplementation on the event class to forward thefire()call to a newPendingEventinstance:Any thoughts on this? Do I overlook something here which maybe causes me trouble in the future?
Beta Was this translation helpful? Give feedback.
All reactions