News for hackers. Stuff that matters.
Re:Flow vs. Typescript by benjoffe on Monday June 06, 2016 @05:38AM (#11845550)
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
Re:Flow vs. Typescript by k__ on Monday June 06, 2016 @06:11AM (#11845642)
Isn't this dangerous?
Re:Flow vs. Typescript by hizanberg on Monday June 06, 2016 @06:53AM (#11845790)
No, you're just telling TypeScript you know what Type it is and it will let you treat it as that Type.