Update to version 2.3.17 show, hide, valueFunction

Hello,
We are upgrading to version 2.3.17 from 2.1.56 and we aren’t sure how to override show, hide and valueFunction when we are making a class that inherits from HTMLElement.
This is what we do in version 2.1.56

export default class AnnotationHTMLInfo extends HTMLInfo {
  constructor() {
    super();

    this.mainElement = null;
  }

    show = (textBlock: GraphObject, diagram: Diagram, tool: Tool) => {
      if (!diagram || !diagram.div) return;
      if (!isTextBlock(textBlock)) return;

      textBlock.panel.part.findObject('nodeAnnotationPanel').opacity = 0;
      propagateEvent(
        diagram.div.id,
        new AnnotationTextEditorOpenedEvent(textBlock, diagram.div, textBlock.part.data as ToolNodeData),
      );
      tool.doCancel();
    };

    hide = () => {};

    valueFunction = () => '';
  }
}

It’s hard to guess what you’re doing wrong, exactly. This seemed to work just fine, when an instance was set as a tooltip:

  class AnnotationHTMLInfo extends go.HTMLInfo {
    constructor() {
      super();
      this.mainElement = null;
    }
    show = (obj, diagram, tool) => {
      console.log('show');
    };
    hide = () => {};
    valueFunction = () => '';
  }

When I try to use show that way (without using this.show) I get this typescript error

Cannot find name 'show'. Did you mean the instance member 'this.show'?

And I get the same errors for hide and valueFunction.

This error was not happening with version 2.1.56. Were you using Typescript or plain Javascript?

I was using plain JS. Here’s my working example with 2.3.17: https://codepen.io/simonsarris/pen/abrdvwy?editors=1011

Note it does nothing but call the show on a toolTip hover, which can be seen in the console.

Can you try it with Typescript and see if you get the same error that I am getting?

This Typescript error is due to the fact that show and hide are now defined this way

    get show(): ((a: GraphObject, b: Diagram, c: Tool) => void) | null;
    set show(value: ((a: GraphObject, b: Diagram, c: Tool) => void) | null);

Can you tell me what I need to do to inherit these functions and override them?

show and hide are properties by default, so its a bit weird to override them, since they should be set by instances of the class, rather than the class definition.

It may be possible to override them regardless, but you might have to use the get/set syntax to do so, instead of setting them to a function, as if they were methods

OK, thank you.