-
Notifications
You must be signed in to change notification settings - Fork 232
Dart2: (keypress) expects (Event e) not (KeyEvent e) #915
Comments
@matanlurey What's the actual error? |
"Expected KeyEvent e got Event e" |
So the issue arises from the following generated line: _el_0.addEventListener('keypress', eventHandler1(_SomeDirective_0_5.handleKeyPress));
I tried to do this work for the user if they specified a type with the following code: My thinking is that when this function is invoked directly as a parameter of Is there a mistake in my reasoning? Is inference not intended to be capable of handling this? I looked at the output of DDC and found this. this[_el_0][$addEventListener](
'keypress',
this.eventHandler1(
html.Event,
html.Event,
EventTovoid()._check(dart.dload(this[_SomeDirective_0_5], 'handleKeyPress')),
),
); By the looks of the parameters (which I assume are the generic type arguments), inference has typed So is this a DDC bug, or am I misunderstanding the type system? @vsmenon |
@leonsenft The inference will only work if we know the static type of |
Of course! The field has type Thanks! |
I am going to assume this is a bug (?) in the compiler, and assign to you for now. |
Closes #915. PiperOrigin-RevId: 186834153
Closes #915. PiperOrigin-RevId: 186834153
Closes #915. PiperOrigin-RevId: 186834153
This fails at the DDC with errors enabled:
https://github.com/dart-lang/angular/blob/f55fea736cb25040be640e75541acfbcd34e0329/_tests/test/core/change_detection/detect_host_changes_test.dart#L67
... I'm not sure why, yet. The temporary fix is to type this
Event
.The text was updated successfully, but these errors were encountered: