You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should the raw api napi_type_tag_object be exposed?
I use External<T> but there is no way to know if the external is of the right type, and a reinterpret_cast will cause seg fault for any javascript error passing an external for another?
I guess I can call it directly on the napi_value. I was just wondering.
Activity
KevinEady commentedon Jan 2, 2023
Yes, this appears to be a missing wrapper in node-addon-api. I can take a look at implementing this.
audetto commentedon Jan 2, 2023
Thanks.
It took me a while to understand the semantics of the various casts and since this is C++ I imagined that they were "safe".
Maybe a line added here:
https://github.com/nodejs/node-addon-api/blob/77350eee98957f471a355a4cf12f6ee05262fa5b/doc/external.md
that there is absolutely no safety and one must do whatever it takes to ensure the cast is sound.
(I use tagging, but maybe there are better ways).
And
As<External<T>>will not fail if one uses the wrongT.mhdawson commentedon Jan 27, 2023
PR to add landed, closing.