How to add ToolbarButton to panel if it's not a Widget type?

I’m following the documentation for 1.2.6 here ->

My code looks like this

    let finishedButton = new ToolbarButton({
      className: 'finishedButton',
      label: "I have finished my assignment",
      onClick: finishedCallback
    });

    panel.toolbar.insertItem(0, 'finishedButton', finishedButton);

The linter says that the third argument in panel.toolbar.insertItem should be a widget and that ToolbarButton is not a widget type, but the documentation example does it this way. What am I doing wrong?