Boris Kolar

Results 4 comments of Boris Kolar

@ffMathy of course it's a bad practice, we all know it. But sometimes you have a field that logically should be private, with one exception. A hack is much simpler...

Workaround: there is a way to access private fields with `myObject["myPrivateField"]` syntax.

@matepek Actually the `someObject["privateField"]` access is type safe: [Playground link](https://www.typescriptlang.org/play?#code/MYGwhgzhAEBiD29oG8BQ0PWPAdhALgE4Cuw+8hAFAA6ECWAbmPgKbRgBc0B9OA5gBpotRszYAjLjmIBbcS0IBKFAF9Ua1CBb5oAM0TQAvNBwsA7nESUARGHHBrQgIwAmAMyLU2PPC0A6EHg+Sn14AG1bawBdZQB6WOgAeQBpVHisXAhfFgCgkMQIgH0waLiEgFEAJUrEyrSE0IiSqKNoAFZodKqayqA)

I love the idea, because I find myself writing `readonly` all the time. Immutable by default would also be very useful for compilers that compile TypeScript to wasm/native code (e.g....