From f3a753de0ca04d6d291390ad0a713daade14d1c0 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 10 Dec 2025 10:27:47 -0800 Subject: [PATCH] =?UTF-8?q?Clarify=20specification=20for=20=E2=80=9Ccontex?= =?UTF-8?q?t.name=E2=80=9D=20for=20private=20vs=20public=20elements.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The babel transpiler I’m using appears to always return a _string_ here (even for private elements). When we looked back at this proposal, it felt like there was potentially room for interpretation! This attempts to make two things more explicit: 1. If the element is private, `context.name` returns a `Symbol`, not a `String`. 2. And, if the element is private `context.name.description` is a `#`-prefixed string mirroring the name provided by the developer. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdd19e6..12cb962 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ The context object also varies depending on the value being decorated. Breaking - `"setter"` - `"field"` - `"accessor"` -- `name`: The name of the value, or in the case of private elements the _description_ of it (e.g. the readable name). +- `name`: The string name of the value, or in the case of `private` elements a unique symbol with a _description_ of the value (e.g. `'field'` or `Symbol('#field')`). - `access`: An object containing methods to access the value. These methods also get the _final_ value of the element on the instance, not the current value passed to the decorator. This is important for most use cases involving access, such as type validators or serializers. See the section on Access below for more details. - `static`: Whether or not the value is a `static` class element. Only applies to class elements. - `private`: Whether or not the value is a private class element. Only applies to class elements.