Remix.run Logo
littlecranky67 4 hours ago

It depends how you construct Dog and Cat. With Javascripts dynamic prototype chain, you could never know for sure.

culi 4 hours ago | parent [-]

Try it

https://www.typescriptlang.org/play/?#code/C4TwDgpgBAIg9gcyg...

reitzensteinm 4 hours ago | parent | next [-]

type Mutt = Dog & Cat

const imposter: Mutt = { bark: () => console.log("woof"), meow: () => console.log("meow"), }

You're both misunderstanding parent's point as well as the original point. Nobody ever claimed your link wouldn't compile.

culi 2 hours ago | parent [-]

I see what you mean, thanks

Well imo GP is fundamentally misunderstanding TypeScript. It's explicitly a structural language not a nominal one. It goes against the entire design philosophy of TS

4 hours ago | parent | prev [-]
[deleted]