Typescript : Type 'Promise<{}>' is not assignable to type 'Promise<void>' -


i have following function :

let templateloader = (ondidfinishload : function, ondidfailload : function) =>     (url : string) : promise<void> =>          new promise(                 (resolve,reject) => {                 mainwindow.loadurl(url);                 mainwindow.webcontents.once(                     'did-finish-load',                     () => {                          ondidfinishload(resolve);                     }                   );                   mainwindow.webcontents.once(                     'did-fail-load',                      (event,errorcode,errordescription) => {                           ondidfailload(reject,errordescription);                      }                   );                }          );  

i've got following compilation error:

error in [at-loader] ./app/loaders.ts:9:9 ts2322: type 'promise {}' not assignable type promise void. type '{}' not assignable type 'void'.

it works modifying promise<void> promise<any>,

or cast new promise new promise<void>.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -