You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The interface signature makes it clear that FileReader is meant to be the target, but because of how the interfaces are structured, this doesn't bubble down properly.
In a vacuum, the simple solution seems to be to make Event be generic on its target:
But two things cause me to hesitate at this patch:
The Event interface is defined in the W3C DOM spec .I'm not quite sure what the policy is upstream with Edge on this, but introducing generics into the typing might be too much deviation from this.
Event touches a lot of stuff, so there's a lot of collateral damage. I think it would require rewriting almost everything related to Events (kind of defeating the purpose of generating lib.d.ts from Edge).
As a side note, I've noticed that there's a lot of onX(ev:Event<Self>)=>any-type event listeners a bit all over the place (where Self is the containing interface). I run into this quite a bit in my own code, I wonder if there's value in having a special type variable to refer to the containing class.
Anyways, I wanted to get some feedback on this before moving forward.
The text was updated successfully, but these errors were encountered:
Been having an issue with this snippet of code:
So when running this as plain JS, I end up logging
{hello:"world"}
. But this doesn't typecheck right now.So currently the interface structures involved in
lib.d.ts
are something like (trimmed for space):The interface signature makes it clear that
FileReader
is meant to be the target, but because of how the interfaces are structured, this doesn't bubble down properly.In a vacuum, the simple solution seems to be to make
Event
be generic on its target:But two things cause me to hesitate at this patch:
Event
interface is defined in the W3C DOM spec .I'm not quite sure what the policy is upstream with Edge on this, but introducing generics into the typing might be too much deviation from this.Event
touches a lot of stuff, so there's a lot of collateral damage. I think it would require rewriting almost everything related to Events (kind of defeating the purpose of generatinglib.d.ts
from Edge).As a side note, I've noticed that there's a lot of
onX(ev:Event<Self>)=>any
-type event listeners a bit all over the place (whereSelf
is the containing interface). I run into this quite a bit in my own code, I wonder if there's value in having a special type variable to refer to the containing class.Anyways, I wanted to get some feedback on this before moving forward.
The text was updated successfully, but these errors were encountered: