Skip to content

fix: allow const vectors with Object::New overload utilizing node_api_create_object_with_properties - #1755

Open
KevinEady wants to merge 1 commit into
mainfrom
use-const-cast-with-node_api_create_object_with_properties
Open

fix: allow const vectors with Object::New overload utilizing node_api_create_object_with_properties#1755
KevinEady wants to merge 1 commit into
mainfrom
use-const-cast-with-node_api_create_object_with_properties

Conversation

@KevinEady

Copy link
Copy Markdown
Contributor

Use const_cast to remove const-qualifier from the pointer returned by the vectors' data() method.

@KevinEady

Copy link
Copy Markdown
Contributor Author

Tested locally against nodejs/node#65621

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.68%. Comparing base (06d56f7) to head (cefce1a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1755   +/-   ##
=======================================
  Coverage   63.68%   63.68%           
=======================================
  Files           3        3           
  Lines        2065     2065           
  Branches      731      731           
=======================================
  Hits         1315     1315           
  Misses        162      162           
  Partials      588      588           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@KevinEady
KevinEady marked this pull request as ready for review August 28, 2026 18:17
@KevinEady
KevinEady requested a review from legendecas August 28, 2026 18:17
Comment thread napi-inl.h
propertyValues.data(),
propertyNames.size(),
&value);
napi_status status = node_api_create_object_with_properties(

@legendecas legendecas Aug 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a TODO to remove the const_cast when nodejs/node#65621 is fully backported?

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

Labels

None yet

Projects

Status: Need Triage

Development

Successfully merging this pull request may close these issues.

3 participants