tc39 / tc39/proposal-private-declarations

Forbid splitting getter/setter across classes

Open
#16 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
26
Forks
2
Avg merge
1m
Merged PRs (30d)
2

Description

This horrible code:

private #foo;
class ReturnOverride {
  constructor() {
    return {
      get outer #foo() {}
    };
  }
}
class AddSetter extends ReturnOverride {
  set outer #foo(x) {}
}
new AddSetter;

or

class ReturnOverride {
  get #foo () {}
  
  static AddSetter = class extends ReturnOverride {
    set outer #foo(x) {}
  };
}
new ReturnOverride.AddSetter;

should not be legal (at runtime). I expect this will happen naturally in the spec but need to be sure (and have tests).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reading the proposal's runtime semantics around private getter/setter declarations, then check both examples in the issue. Done means the split getter/setter cases are rejected at runtime and tests cover both forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.