I try to define return from the method that would return Promise of an array of objects:
public readAll( ) : Promise<any[]> {
this.handler.getObject( {
Bucket : this.bucket,
Key : this.tableName + '.json',
ResponseContentType : 'text/plain'
} )
.promise( )
.then( file => {
const data : any[] = this._parseData( file.Body.toString( ) );
return new Promise( ( resolve ) => data );
} )
.catch( error => {
return this.writeAll( );
} );
}
however, I am facing error "[ts] A function whose declared type is neither 'void' nor 'any' must return a value."
What am I doing wrong?