Closed supanadit closed 5 years ago
The information about protected/private is not available at runtime. TypeScript only uses the class member modifiers to statically analyze your code at compile-time. After compilation is done, a private attribute on a class is no different than a public one.
So it is impossible to hide unwanted key while parsing to TOML ?
It doesn't have much to do with TOML, the exact same thing would happen if you'd want to serialize to JSON. Unless, of course, you're using static analysis to read the code (as opposed to execute the code in the browser or in Node environment).
To do it at run-time, you might want to check our decorators. For example, class-transformer
utilizes them to perform serialization for sending and receiving data via the network.
I am using typescript, it should not appear on TOML after parse if the variable was Protected or Private