I feel like I’m always struggling with event handlers and thought I’d propose this change or at least see what people thought of it:
Should Dom.event be Dom.event<'eventTarget>?
It would eliminate the need to define a type for every possible interface that inherits from Event and would allow better typing for event.target (which is I think the first thing people usually need to access when writing an event handler).
Of course I could always just make my own types how I want, but I figured I’d put it on the floor and see what folks thought.
There are many things about the built-in DOM types that would be nice to improve, such as making them records to access common properties. But I’m not sure they can be changed without breaking every app that uses them.
a common pattern I now use for bindings is indeed to use a private record to access the properties while still relying to @send for methods. Since it would still be the same type t, I don’t think it would break anything if the type doesn’t have to be converted to a polymorphic type. But definitely, some types should be made polymorphic too, but that’s what major versions are made for