News for hackers. Stuff that matters.
Re:Tricks I wish I knew when I learned TypeScript by jakelazaroff on Tuesday October 12, 2021 @02:26PM (#28843223)
Isn't this true for any abstraction, though? If the person who wrote it is inaccessible, you have to understand it by reading the source.
Re:Tricks I wish I knew when I learned TypeScript by pavel_lishin on Tuesday October 12, 2021 @09:50PM (#28847327)
Sure. But this is easier to understand, albeit means repeating code:

    class B {
        foo: number;
        bar?: number;
        baz: number;
    }
I know these are toy examples, and I'm sure there are reasons why in the real world you'll be modeling things where this is not a good option. But I'd really need to be convinced that the CRUD webapps a lot of us write actually benefit from having this in our source code.