Sergey Radzishevskii
1 min readJun 26, 2019

--

Don’t use private accessor within Component class — very debatable 👇.

  • TS will throw an error during compilation.
  • Your IDE will highlight that warning as well.

That’s why we love and use TS. It won’t allow you to do bad things

class A {
private foo() {
}
}
(new A()).foo();

index.ts:6:11 - error TS2341: Property 'foo' is private and only accessible within class 'A'.

6 (new A()).foo();

Instead, you suggest relying on the _naming convention that could be different in different projects.

So for me, it sounds — let’s do it like this because I’m so used to it, not because it’s right.

--

--

Sergey Radzishevskii
Sergey Radzishevskii

Written by Sergey Radzishevskii

Enjoy turning complex systems into intelligible architectures chilling in my garden.

No responses yet