fix: make eventUtils throw if event type not registered (#6381)

* chore: update lint rules

* fix: have eventUtils.get throw if event isn't found

* chore: remove nonnull assertion from eventUtils.get and format
This commit is contained in:
Maribeth Bottorff
2022-08-24 13:41:32 -07:00
committed by GitHub
parent 980fe138e7
commit 60bc01acc8
29 changed files with 98 additions and 94 deletions

View File

@@ -163,8 +163,8 @@ export class BlockDragger implements IBlockDragger {
/** Fire a UI event at the start of a block drag. */
protected fireDragStartEvent_() {
const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))!
(this.draggingBlock_, true, this.draggingBlock_.getDescendants(false));
const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))(
this.draggingBlock_, true, this.draggingBlock_.getDescendants(false));
eventUtils.fire(event);
}
@@ -312,8 +312,8 @@ export class BlockDragger implements IBlockDragger {
/** Fire a UI event at the end of a block drag. */
protected fireDragEndEvent_() {
const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))!
(this.draggingBlock_, false, this.draggingBlock_.getDescendants(false));
const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))(
this.draggingBlock_, false, this.draggingBlock_.getDescendants(false));
eventUtils.fire(event);
}
@@ -352,8 +352,8 @@ export class BlockDragger implements IBlockDragger {
/** Fire a move event at the end of a block drag. */
protected fireMoveEvent_() {
const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))!
(this.draggingBlock_) as BlockMove;
const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))(
this.draggingBlock_) as BlockMove;
event.oldCoordinate = this.startXY_;
event.recordNew();
eventUtils.fire(event);