Skip to content

Node.js structuredClone objects do not preserve prototypes #54603

Description

@avivkeller

When using structuredClone with and transferring the original in Node.js, the resulting clone's prototype is not the same as the original's. However, in other environments, the prototype remains consistent.

const original = new ReadableStream();
const transfer = structuredClone(original, { transfer: [original] });
console.log(Object.getPrototypeOf(transfer) === ReadableStream.prototype);

In Node.js, the above snippet logs false, however, in other environments, it logs true.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.web streamsIssues and PRs related to the Web Streams API.web-standardsIssues and PRs related to web-platform APIs and standards compliance.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions