Skip to content

src,doc,test: accept SharedArrayBuffer in napi_create_typedarray#62710

Open
umuoy1 wants to merge 2 commits intonodejs:mainfrom
umuoy1:feat/napi-typedarray-sharedarraybuffer
Open

src,doc,test: accept SharedArrayBuffer in napi_create_typedarray#62710
umuoy1 wants to merge 2 commits intonodejs:mainfrom
umuoy1:feat/napi-typedarray-sharedarraybuffer

Conversation

@umuoy1
Copy link
Copy Markdown
Contributor

@umuoy1 umuoy1 commented Apr 12, 2026

This PR updates napi_create_typedarray() to accept SharedArrayBuffer in addition to ArrayBuffer.

Today, napi_create_dataview() already accepts both ArrayBuffer and SharedArrayBuffer, but napi_create_typedarray() still only accepts ArrayBuffer. This creates an inconsistency in Node-API behavior and does not align with JavaScript semantics, where TypedArrays can be backed by SharedArrayBuffer.

Signed-off-by: umuoy1 <burningdian@gmail.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/node-api

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API. labels Apr 12, 2026
Signed-off-by: umuoy1 <burningdian@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

❌ Patch coverage is 63.88889% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.80%. Comparing base (dfe438d) to head (265fa6f).

Files with missing lines Patch % Lines
src/js_native_api_v8.cc 63.88% 1 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62710      +/-   ##
==========================================
- Coverage   89.81%   89.80%   -0.02%     
==========================================
  Files         699      699              
  Lines      216379   216384       +5     
  Branches    41366    41374       +8     
==========================================
- Hits       194340   194317      -23     
- Misses      14139    14142       +3     
- Partials     7900     7925      +25     
Files with missing lines Coverage Δ
src/js_native_api_v8.cc 76.10% <63.88%> (-0.40%) ⬇️

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API.

Projects

Status: Need Triage

Development

Successfully merging this pull request may close these issues.

2 participants