Use bidi-js to handle BiDi.
The following examples are from What HarfBuzz doesn't do and Improving Arabic and Hebrew text in map labels.
ts
const text = new Text({
x: 50,
y: 100,
content: 'ABCג ב אDEF',
fontSize: 30,
fill: '#F67676',
});
const text2 = new Text({
x: 50,
y: 150,
content: 'سلام',
fontSize: 30,
fill: '#F67676',
});