Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Allow Private Fields to Transparently Tunnel through Proxies #102

@Jamesernator

Description

@Jamesernator

This was mentioned in #1 but I don't really see why it's the case e.g. I'd find it quite surprising if this did not work:

class Point {
    #x
    #y
    constructor(x, y) {
        this.#x = x
        this.#y = y
    }

    add(other) {
        return new Point(this.#x + other.#x, this.#y + other.#y
    }
}

const p = new Point(3, 4)
const p2 = new Proxy(new Point(4, 5), {})

const p3 = p.add(p2) // TypeError
```

If there is a good reason for not forwarding them it'd be nice to see it added to the FAQ.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions