Skip to content

Input event #6

@akoidan

Description

@akoidan

Prelude:
I (and many other developers) rely on this package + target es5 in tsconfig.json that everything would work on ie11, edge 15 and etc, while recklessly developing in Chrome.

The thing that I found out, experimentalDecorators generated InputEvent to the resulting js file. And it just crashed on production in Edge 15, despite I didn't even use the ReflectMetadata package. I blindly did what guide in other libs tell, enabling magic property in tsconfig (experimentalDecorators). I'm telling all of these because that what other devs might face.

Yeah, of course, that happened by my fault because I wrote code, not even expecting that typing could break anything:

class A {
  a(b: InputEvent) {
  }
}

What I propose is to have something like these, to reduce those kinds of risk:

if (!window.InputEvent) {
  console.error('InputEvent is not supported for Edge/IE, stubbing it with mock');
  window.InputEvent = (): void => {};
}
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions