3 ms·
Maybe this comparison doesn't make sense since Typescript isn't an implementation, just a type model, but anyway. In Typescript it is also similar in that it's
by Too 9y ago
Maybe this comparison doesn't make sense since Typescript isn't an implementation, just a type model, but anyway. In Typescript it is also similar in that it's only the list of members that define which type of object you have, there is no class name. You only have "interfaces" defining the required members which classes can implement, which makes it compatible with duck typing. So you can have an XY interface which both Vector2D(x,y) and Point2D(x,y) will implement and they will both also implement the X-interface and Y-interface at the same time.