As I struggled to transform DSL mqtt actions to javascript in OH3, I thought I’d publish my solution:
var Actions = Java.type("org.openhab.core.model.script.actions.Things");
var mqttActions = Actions.getActions("mqtt","mqtt:broker:yourBrokerID");
mqttActions.publishMQTT("yourtopic", "hurray!");
This is the way I currently do it too (OH2), and it works. I use Visual Studio Code with the openHAB plugin - is there a reason why action is red underlined by VSC as being an error in the code? Presumably VSC doesn’t know that actions is in the default script scope?
I’m not aware of any work that has been done in the VSC OH extension for the new rule engine, scripted automation, or any of the scripting languages, but @Confectrician may have more information.