javascript - How do I access get the base type in Typescript? -


after trying grasp how traverse prototype chain in generated javascript, failed implement function writeinheritedname() in example below. idea find base type , write name. ideas?

class animal { }  class snake extends animal { }  function writeclassname( cls ) {    console.log( cls.name ); }  function writeinheritedname( cls ) {    console.log( "i wish new how write animal" ); }  writeclassname( snake ); writeinheritedname( snake ); 

found out myself.

 function writeinheritedname(cls) {     console.log( object.getprototypeof(cls.prototype).constructor.name );  } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -