Support ES Private Methods in TypeScript #5258
Labels
bug
Something isn't working correctly
fix available
there is a fix available in a third party library that needs to be merged
upstream
Changes in upstream are required to solve these issues
Milestone
Currently we support both private fields (
#foo = "bar"
) and private methods (#foo() {}
) in the version of v8 we use in Deno. So the following is valid in JavaScript:The problem is that while private fields are allowed in TypeScript, private methods are not currently allowed. This was because private fields and private methods were two seperate proposals and private methods took longer to reach Stage 3.
We have been working around this by setting an arrow function as the initialiser for a private field, but that is actually sub-optimal as these are not "static" as part of the classes prototype and are initialised on every construction of an instance.
This is a tracking issue for microsoft/TypeScript#37677 which deals with ES private methods in TypeScript.
The text was updated successfully, but these errors were encountered: