Skip to content

Interpreter: async generator rejection exposes an unbranded strict-delete error #3559

Closed

Description

@nickna

An interpreted async generator rejects when a built-in operation throws a TypeError, but its rejection handler gets an unbranded value rather than the guest error object.

"use strict";
async function* inspect(value) { yield delete value.length; }
inspect("x").next().then(
    result => console.log("fulfilled", result.value),
    error => console.log("rejected", error instanceof TypeError, error.name, String(error)));

Node v22.23.2 prints rejected true TypeError TypeError: Cannot delete property 'length' of [object String]. Interpreted SharpTS on clean main a3683d903 and PR #3552 332e50d07 prints rejected false undefined TypeError: Cannot delete non-configurable string property 'length'. Run as a classic JS file with --no-tsconfig --noLib.

Control: an async generator that explicitly executes throw token for const token = new TypeError("token") keeps both the guest error brand and identity in the rejection callback on clean main. The above test uses an explicit script directive, so it is separate from implicit ESM strictness (#3504).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions