How to get class name of native class

You may not like this, but I wonder if you could make a wrapper class that hosts the find function, and creates a dynamic script based on the type. Maybe throw some memorization so you don’t have to generate it dynamically every time? Although you will still have to define a return value.

Anyway I took a look at the source code and at the typed array function you mention, the script only has to be valid for the array type to work. That means it has be an instance. Although it’s not clear if it is used anywhere else.

Have you tried just casting with as instead of assigning?