This reports an error when using bind in ts. The case is as follows

function a () {console.log (this);} var tc: any = {a: 0}; var cz = a.bind (tc); cz ();

Jun.30,2022


interface ITc {
   a: number
}

//  this 
function a(this: ITc) { 
  console.log(this);
} 

var tc: ITc = { a: 0 }; 
var cz = a.bind(tc); 
cz();
Menu