Property 'elt' does not exist on type 'GraphObject'

Trying to implement the below :

  {
        // a mouse-over highlights the link by changing the first main path shape's stroke:
        mouseEnter: function(e, link) { link.elt(0).stroke = "rgba(0,90,156,0.3)"; },
        mouseLeave: function(e, link) { link.elt(0).stroke = "transparent"; }
      }

In typescript, this elt is not a known property of link. I had to fallback on link['elt'](0).stroke

Is there a better way ?

  link.path.stroke = ...

nope, I get Property 'path' does not exist on type 'GraphObject'

How about:

function(e, link: go.Link) { link.path.stroke = ... }

This assumes you have declared those event handlers on the Link itself, not on some GraphObject within the link template. That is normally desired, so that the mouse passing over a label (including the arrowhead) will result in event bubbling up to the Link.

The event handlers are in the link template. I thought that was the right place to do it, at least this is how it is demonstrated here GoJS Links -- Northwoods Software.

can you show me some example ? how would I do it on the link itself ? (in linkdata ?)

That’s right – I meant on the Link of the link template.

ok, got it. It works fine now.