https://github.com/Microsoft/TypeScript/issues/202
It's in the roadmap, but discussions about it are still going on four years after the ticket was opened...
It's in the roadmap, but discussions about it are still going on four years after the ticket was opened...
interface SomethingWithAge{ age(); }
class Person{ age(); // age in years }
function classify( SomethingWithAge item ){ if( item.age() < 20 ){ print( 'young') } else{ print( 'old' ); } }
p = new Person( 33 ); classify( p ) // prints 'old'
class Message{ age(); // age in milliseconds }
c = new Message( 231443 );
classify( c ); // prints 'old'