Tuesday, 18 April 2017

Declare assigned property to returned function

I am doing some pretty crazy stuff with this, but it's been working for awhile:

function foo(cb){

   return function bar(){

       bar.x = 'y';
       cb();

   }


}

don't ask why :), but it's been working for me. Now I am converting this JavaScript code to TypeScript. Is there a way to declare the type of the returned function so I can declare the function has a property called "x"?



via Alexander Mills

No comments:

Post a Comment