I came across the code below:
function asyncTask(): Promise<string> {
return new Promise<string>(resolve => resolve);
}
This code resulted in the following error:
TS2304: cannot find name 'Promise'
To address this issue, I decided to explicitly declare 'Promise' as follows:
///<reference path="../typings/modules/bluebird/index.d.ts" />
import * as Promise from 'bluebird';
function asyncTask(): Promise<string> {
return new Promise<string>(resolve =>resolve);
}
However, this led to a new error:
TS2529: Duplicate identifier 'Promise'. Compiler reserves name 'Promise' in top level scope of a module containing async functions
How can I resolve this conflicting situation?