From 29b6b878dc621acd6e11c34aec2e3bce25bb2508 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 21 Apr 2022 13:22:21 -0700 Subject: [PATCH] fix: Silence Closure errors when modifying tooltips. (#6098) --- core/block_svg.js | 2 +- core/field.js | 2 +- core/flyout_base.js | 2 +- core/tooltip.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 777dc1230..ec76a0493 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -248,7 +248,7 @@ class BlockSvg extends Block { svgMath.is3dSupported() && !!workspace.getBlockDragSurface(); const svgPath = this.pathObject.svgPath; - svgPath.tooltip = this; + (/** @type {?} */ (svgPath)).tooltip = this; Tooltip.bindMouseEvents(svgPath); // Expose this block's ID on its top-level SVG group. diff --git a/core/field.js b/core/field.js index f91cb33b4..1860cd617 100644 --- a/core/field.js +++ b/core/field.js @@ -1097,7 +1097,7 @@ class Field { } const clickTarget = this.getClickTarget_(); if (clickTarget) { - clickTarget.tooltip = newTip; + (/** @type {?} */ (clickTarget)).tooltip = newTip; } else { // Field has not been initialized yet. this.tooltip_ = newTip; diff --git a/core/flyout_base.js b/core/flyout_base.js index e2f8704da..82be038ab 100644 --- a/core/flyout_base.js +++ b/core/flyout_base.js @@ -1045,7 +1045,7 @@ class Flyout extends DeleteArea { 'width': blockHW.width, }, null); - rect.tooltip = block; + (/** @type {?} */ (rect)).tooltip = block; Tooltip.bindMouseEvents(rect); // Add the rectangles under the blocks, so that the blocks' tooltips work. this.workspace_.getCanvas().insertBefore(rect, block.getSvgRoot()); diff --git a/core/tooltip.js b/core/tooltip.js index 2d7105f65..f5925a723 100644 --- a/core/tooltip.js +++ b/core/tooltip.js @@ -363,7 +363,7 @@ const onMouseOut = function(_e) { * @param {!Event} e Mouse event. */ const onMouseMove = function(e) { - if (!element || !element.tooltip) { + if (!element || !(/** @type {?} */ (element)).tooltip) { // No tooltip here to show. return; } else if (blocked) {