microsoft / microsoft/TypeScript
super reference in private method throws
Open
@rbuckton is already working on this.
Since Jun 9, 2021.
Bug
Domain: classes
Rescheduled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
private, super
🕗 Version & Regression Information
v4.3.2, also tested with nightly in playground
works with ESNext setting (which just strips out the types), Babel, V8
⏯ Playground Link
💻 Code
class A {
test() {
return 'test'
}
}
class B extends A {
#foo() {
return super.test()
}
bar() {
return this.#foo()
}
}
const b = new B().bar()
console.log(b)
// [ERR]: "Executed JavaScript Failed:"
// [ERR]: 'super' keyword unexpected here
🙁 Actual behavior
throws error
🙂 Expected behavior
prints 'test'
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.
Assessment
This issue has not been assessed yet.