Skip to content

Documentation mismatch for N-API structures #13469

Closed
@RReverser

Description

@RReverser

Documentation on the N-API page describes napi_property_attributes as following:

typedef enum {
  napi_default = 0,
  napi_read_only = 1 << 0,
  napi_dont_enum = 1 << 1,
  napi_dont_delete = 1 << 2,
  napi_static_property = 1 << 10,
} napi_property_attributes;

whereas src/node_api_types.h describes it as:

typedef enum {
  napi_default = 0,
  napi_writable = 1 << 0,
  napi_enumerable = 1 << 1,
  napi_configurable = 1 << 2,

  // Used with napi_define_class to distinguish static properties
  // from instance properties. Ignored by napi_define_properties.
  napi_static = 1 << 10,
} napi_property_attributes;

Basically, values of all bit flags were inverted.

Given the last commit, it seems it's the documentation that is outdated here but would be nice to confirm and sync two places to agree with each other.

Another one is napi_property_descriptor - website docs don't mention second name field of type napi_value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions