How to remove elements from replace popup?

I have tried adding my own custom CustomReplaceMenuProvider.js which is a copy of ReplaceMenuProvider.js, and my own custom ReplaceOptions.js where I have removed all the types that I do not want to be able to replace to.

When debugging I see that it is not replacing the current elements with my empty list, but rather checking the difference and attempting to ‘add’ the empty list of options.

Is it possible to totally override the options? Or am I on the wrong track to remove elements from the popup?
Images of what I am trying to remove:
image
image

A popup menu provider (which the replace menu is) can return an updater function in its getPopupMenuEntries method. This allows to return a totally new set of entries or to replace or remove entries returned by previous providers. Notice that Replace Menu uses a legacy API getEntries which does not have this capability. Check out the test case: diagram-js/PopupMenuSpec.js at develop · bpmn-io/diagram-js · GitHub

You can also look up this example update PR: docs: update popup menu provider example by barmac · Pull Request #678 · bpmn-io/diagram-js · GitHub