getNativeObject doesn't check if the given js object corresponds to the expected native type.
Indeed, if we pass Car js object instead of a Brand, getNativeObject casts a native Car pointer as a Brand native object, leading to unknown behavior.
See https://github.com/lightpanda-io/jsruntime-lib/blob/main/src/engines/v8/generate.zig#L727
To ways are possible to do the check:
- use a C++ function to check if the js object prototype corresponds to the expected native type
- add a second internal field with an integer identifying the native type