3 ms·
You can also use 'type assertions' to minimise restructuring, eg, the following is the same number of lines as your first example (and compiles to identical cod
by benjoffe 10y ago
You can also use 'type assertions' to minimise restructuring, eg, the following is the same number of lines as your first example (and compiles to identical code):
const a = A()
a.b = new SubtypeOfB()
(<SubtypeOfB> a.b).attributeOfSubtypeOfB = 123 //works