That’s barely scratching the surface.
In TypeScript the following is also valid:
class Something{
value: Number
}class SomethingElse{
value: Number
foo: String
bar: SomeOtherThing[]
}function AddSomething(v: Something)
{
v.value += 1;
}var ex = new SomethingElse{
value: 3,
foo: “TypeScript is fake types”,
bar: []
};AddSomething(ex);
Why does it work? Because in TypeScript as long as you have a “shape” that fits, it’s the “same type.”
Complete and utter insanity to me, to pretend there’s any real type checking, when types are entirely fake and made up.