napi-rs/examples/napi-compat-mode/__test__
nihohit 1cf32631bf
fix(napi): typed arrays ref shouldn't use offset. (#1376)
Notice from the n-api docs that the data returned from
`napi_get_typedarray_info` is already adjusted by the byte offset.
https://nodejs.org/api/n-api.html#napi_get_typedarray_info

This means that when `as_ref`/`as_mut` apply the byte offset, the
offset is in practice applied twice.
This wasn't caught in tests because no test tried to modify a typed
array with a byte offset, and the test didn't us the typed array
structs, only `JsTypedArray`. If you want, I can modify the rest of the
functions in examples/napi-compt-mode/src/arraybuffers.rs
and the matching tests, to test all typed arrays.

IMO the `byte_offset` field can be removed entirely from the struct,
but I wanted to submit a minimal PR.
2022-11-30 20:54:13 +08:00
..
napi4 feat(napi): add threadsafe deferred values (#1306) 2022-10-03 13:00:48 +08:00
napi5
napi6
napi7
napi8
serde test: update snapshots format for ava@4 2022-01-04 11:04:45 +08:00
array.spec.ts
arraybuffer.spec.ts fix(napi): typed arrays ref shouldn't use offset. (#1376) 2022-11-30 20:54:13 +08:00
buffer.spec.ts fix(napi): use create_buffer/arrary_buffer if provided data is empty 2022-04-26 16:53:13 +08:00
class.spec.ts
cleanup-env.spec.ts
create-external.spec.ts
either.spec.ts
env.spec.ts
function.spec.ts fix(napi): improve error propagation (#1303) 2022-09-14 17:03:11 +08:00
get-napi-version.spec.ts fix(napi-derive): BigInt in TypeScript should be bigint 2022-01-06 22:33:34 +08:00
global.spec.ts
js-value.spec.ts
napi-version.ts
object.spec.ts chore: upgrade dependencies 2022-03-13 18:30:11 +08:00
object.spec.ts.md
object.spec.ts.snap test: update snapshots format for ava@4 2022-01-04 11:04:45 +08:00
spawn.spec.ts
string.spec.ts
string.spec.ts.md
string.spec.ts.snap test: update snapshots format for ava@4 2022-01-04 11:04:45 +08:00
symbol.spec.ts
throw.spec.ts test: update snapshots format for ava@4 2022-01-04 11:04:45 +08:00