I declare a mapimagelayer
const MPl = new MapImageLayer({
----
----
Then I created an array of sublayers that need to be visilbe.
I added the sublayers index in an array
thearr.push({
id: 1,
visible: true},
{
id: 3,
visible: true}
);
Then, I used:
MPl.sublayers = thearr;
but I got an error

When I used this script without using typescript i have no errors and it runs fine.