News for hackers. Stuff that matters.
Re:Announcing TypeScript 2.0 by qwertyuiop924 on Friday September 23, 2016 @05:31AM (#12563349)
Huh. Pretty cool. Are the interfaces Go-style (must you declare a class/object as that interface, or is it just detected)?

Because if it's not, than it's not duck typing, is it?

Re:Announcing TypeScript 2.0 by Too on Friday September 23, 2016 @12:29PM (#12565834)
Interfaces in typescript are implicit, or auto detected. You dont have to say that a class implements an interface, if it has the correct properties it automatically fulfills the interface. It's like type safe ducktyping and it's super awesome.
Re:Announcing TypeScript 2.0 by Roboprog on Sunday September 25, 2016 @12:35PM (#12576017)
Sounds like it works just like Go-lang, then.

Is there a way to cast something anonymous, just a value read in from JSON, to such an interface? This would allow you to specify an important subset of things that an object needs to do, verify it in one place, then pass around the interface handle to anything that needed the underlying object in that role. Presumably, if the incoming object lacked the desired attributes, the "cast" would blow up sooner, during the assignment, rather than later, when the interface alias was used.

Re:Announcing TypeScript 2.0 by qwertyuiop924 on Friday September 23, 2016 @09:51PM (#12569082)
That's just compile-time verified duck typing.

Not bad.

Re:Announcing TypeScript 2.0 by betenoire on Friday September 23, 2016 @10:47PM (#12569203)
Static weak types
Re:Announcing TypeScript 2.0 by qwertyuiop924 on Saturday September 24, 2016 @03:04PM (#12572100)
No, because you're not doing implicit type conversion, which is what weak typing implies.