Except Typescript embraces duck typing. You can say "accept any object with a quack() method", for example, and it'll accept an unexpected quacking parrot. It can even tell when two type definitions are close enough and merge them.
Except Typescript embraces duck typing. You can say "accept any object with a quack() method", for example, and it'll accept an unexpected quacking parrot. It can even tell when two type definitions are close enough and merge them.
So does Python. They're called protocols. [0]
[0]: https://typing.python.org/en/latest/spec/protocol.html
> Except Typescript embraces duck typing.
So does Python:
https://typing.python.org/en/latest/spec/protocol.html
It's not duck typing if you have to declare the type...
Kind of, depends on the compiler configuration.
Doesn't Go also use structural typing?