It would be good to write clearly what you hope to achieve with this topic.
You are trying to write UXP, but the document you are reading is for ExtendScript. Please refer to document UXP for Adobe Photoshop 2022.
thanks! Is there any function similar to the fill function?
Unfortunately I am not that familiar with that field. Please examine the aforementioned documents.
If you can’t find a similar method, mostly batchPlay will do the work.
I’m not sure if there is an API for that or not, but the Alchemist plugin should be able to provide the UXP batchPlay equivalent.