Remix.run Logo
saghm 3 days ago

That's because it's structurally typed (as opposed to nominally typed). I don't happen to prefer it, but I don't think it's fair to conflate that with unsoundness like the example given above; it's totally possible to have a sound structural type system. TypeScript doesn't happen to be sound, but it's not because of that.

teaearlgraycold 3 days ago | parent [-]

Structural typing is great. It's the verified version of duck typing.

LelouBil 3 days ago | parent [-]

You can even get nominal typing with branded types if you need it. (Like for the newtype pattern)