New decorators and enumerability
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.2k
- Forks
- 1.8k
- Avg merge
- 1h 38m
- Merged PRs (30d)
- 1
Description
I'm just catching up on MobX and the new decorators with the accessor syntax, which I don't really like (far more noise than one makeObservable call), but I get it.
What I don't get is the fact that the new properties are not enumerable, and not own properties?
If we have a very basic class like
class Foo
{
@observable accessor name = "Unnamed"
num = 1
}
in what world does it make sense that "name" is neither an own property nor enumarable but num is?
This makes toJS() totally useless, especially for stuff like just logging and knowing what the hell is going on in my application. Same for JSON.stringify(). Useless.
So now I need to write manual JSON-ification schemes or use external libraries just to know what is going on in my application?
The reasons given in https://mobx.js.org/enabling-decorators.html / "Decorator changes / gotchas" seem incredibly hand-wavy compared to these actual problems?
"following the spirit of the ES language and what accessor means" is nice, but how about you follow what MobX means and what it presents as abstraction to the user? Same for OOP purity. Is there any other situation where MobX enforces OOP purity at the expense of functionality?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the class example and comparing the output of toJS() and JSON.stringify(); then read the linked “Decorator changes / gotchas” section. No target file, test, or accepted behavior is named, so the desired change and completion criteria need maintainer clarification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100