News for hackers. Stuff that matters.
Re:Typescript: class vs. interface by zwieback on Tuesday February 27, 2018 @11:54AM (#16475285)
I don't understand the point at the end, showing that interface definitions don't create code doesn't have anything to do with code generated for actual instantiation. Once you create an instance of something, no matter what mechanism is used, code will get created, contract enforcement has nothing to do with that.

Comparing to OOP languages I see the class definitions in the beginning of the post as "data grouping" and not as contracts so I don't quite understand what's being contrasted here.

Re:Typescript: class vs. interface by Parsyval on Tuesday February 27, 2018 @12:18PM (#16475556)
Of course, you are right when you say "Once you create an instance of something [...] code will be created". But what I am pointing here is BEFORE you create any instance of anything.

You define a contract, what your object should look like. With an interface it's checked before runtime and then translates to no code. But using a class, you have code generated for the runtime.

Re:Typescript: class vs. interface by zwieback on Tuesday February 27, 2018 @12:54PM (#16475982)
Are you concerned about code size then? That would make sense for a browser app, coming from desktop I'm not too concerned with code that gets generated but might not get called.