-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Milestone
Description
Describe the bug
Event code makes some unsafe assumptions about which properties will or won't exist on an event. Also, the types of some properties vary between event classes. This can cause type checking issues.
Additional context
Some examples I found while converting event classes to ES6 classes:
typeused to not be declared onAbstract. I've declared it, but it has to have typestring|undefinedand be set toundefinedin the abstract class to not break existing tests. In the interest of touching the minimum amount of code during this conversion, I annotated it to make the tests pass.blockIdis not declared on every type of event. On some events it's declared as a non-nullable string. On others it seems to be a nullable string. Event filtration code uses theblockIdproperty as part of a hash, regardless of whether the class says it exists.- I can't fix this with
Object.hasOwnPropertybecause I also need to look for inherited properties. - There isn't a common base class (other than
Abstract) that I can cast to in the filtration code.
- I can't fix this with
Next steps
- List all event properties that are being used inconsistently this way.
- Audit event properties to understand which are unsafely being used when they are
nullorundefined - Update types on any properties with these issues, adding casts as needed.