4 ms·
Don't you get problems with equal Signatures but different meaning or different scale? Example: interface SomethingWithAge{ age(); } class Person{ age(); //
by dorgo 9y ago
Don't you get problems with equal Signatures but different meaning or different scale?
Example:
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'
- spiralx 9y agohttps://github.com/Microsoft/TypeScript/issues/202 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...