We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When returning a typed array, like JsInt16Array for example, the following JavaScript expression will evaluate to false:
JsInt16Array
false
x instanceof Int16Array
Using Jest, this assertion
expect(arr).toBeInstanceOf(Int16Array)
fails and reports the following:
Expected constructor: Int16Array Received constructor: Int16Array
This makes me suspect that Neon is using a constructor function with an identical name, but different equality identity.
The text was updated successfully, but these errors were encountered:
@sockmaster27 are you using any transpilers that could be polyfilling or transforming typed arrays?
I am not ables to reproduce with a simple test:
use neon::prelude::*; #[neon::main] fn main(mut cx: ModuleContext) -> NeonResult<()> { cx.export_function("array", |mut cx| { JsInt16Array::from_slice(&mut cx, &[0, 1, 2, 3]) })?; Ok(()) }
npm install node -e 'console.log(require(".").array() instanceof Int16Array)' # true
Internally, Neon is calling napi_create_typed_array.
napi_create_typed_array
Sorry, something went wrong.
It appears to be a problem with Jest. Sorry for the inconvenience.
No branches or pull requests
When returning a typed array, like
JsInt16Array
for example, the following JavaScript expression will evaluate tofalse
:Using Jest, this assertion
fails and reports the following:
This makes me suspect that Neon is using a constructor function with an identical name, but different equality identity.
The text was updated successfully, but these errors were encountered: