Skip to content

Commit

Permalink
fix: Silence Closure errors when modifying tooltips. (#6098)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored Apr 21, 2022
1 parent eb0dbe1 commit 29b6b87
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion core/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/flyout_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion core/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 29b6b87

Please sign in to comment.