129
rated 0 times
[
136]
[
7]
/ answers: 1 / hits: 29246
/ 7 Years ago, fri, july 28, 2017, 12:00:00
I have the 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 the following compilation error:
ERROR in [at-loader] ./app/loaders.ts:9:9
TS2322: Type 'Promise {}' is not assignable to type
Promise void. Type '{}' is not assignable to type 'void'.
More From » typescript