Skip to content

private fields not handled by proxies (f.e. createMutable) #2562

@trusktr

Description

@trusktr

Describe the bug

import { createMutable } from "solid-js/store";

class MyClass {
  #a = 123
  get a() { return this.#a }
  set a(val) { this.#a = val }

  constructor() {
    return createMutable(this) // comment this out and the example works
  }
}

const o = new MyClass()
console.log(o.a) // runtime error

Your Example Website or App

https://playground.solidjs.com/anonymous/553aed2c-926e-41b6-8684-c63c8122c5db

Steps to Reproduce the Bug or Issue

Run the playground.

Expected behavior

no error, "123" should be logged

Screenshots or Videos

N/A

Platform

N/A

Additional context

Solid's Proxys need to be updated to handle private fields.

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