TrustedHTML Refused to evaluate a string as JavaScript

After try to run this script in Google Docs I’m receiving this error:

const macroCompleted = function () {
window.postMessage(
{
sender: ‘proper’,
type: ‘completed’
},
‘*’
);
};

return macroCompleted();

[error][ignored]
Line 128: Error in executeScript code: Refused to evaluate a string as JavaScript because this document requires ‘Trusted Type’ assignment.

Any idea why this is happening on google sites? or any solution for this?

a website can choose to block executescript try executescript_sandbox instead