You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two classes abc and def. In the first, a property x is marked as private with an accessibility modifier. In the second, a property y is also marked as private but with a # prefix. If instances of both classes are converted using JSON.stringify, the property is not converted in case of class def and the property y. That is the expected behavior. The translation of a property marked as private should take this into account.
[LOG]: "{}"
[LOG]: "{}"
Actual behavior:
Although the property x in class abc is marked as private, it is converted using JSON.stringify.
"use strict";// An accessibility modifier cannot be used with a private identifier.(18010)var_y;classabc{constructor(){this.x="hello";}}classdef{constructor(){_y.set(this,"world");}}_y=newWeakMap();console.log(JSON.stringify(newabc()));console.log(JSON.stringify(newdef()));/*[LOG]: "{"x":"hello"}"[LOG]: "{}"*/
TypeScript Version: 4.0.2
Search Terms:
accessibility modifier private identifier
Expected behavior:
There are two classes abc and def. In the first, a property x is marked as private with an accessibility modifier. In the second, a property y is also marked as private but with a # prefix. If instances of both classes are converted using JSON.stringify, the property is not converted in case of class def and the property y. That is the expected behavior. The translation of a property marked as private should take this into account.
Actual behavior:
Although the property x in class abc is marked as private, it is converted using JSON.stringify.
Related Issues:
no
Code
Output
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: