When I'm trying a code like in the example from README.MD:
getAllCustomers(): Promise<Customer[]> {
let query = EntityQuery.from('Customers').orderBy('companyName');
return this._em.executeQuery(query)
.then(res => res.results)
.catch((error) => {
console.log(error);
return Promise.reject(error);
});
}
It doesn't compile with an error:
Type 'Promise<Entity[]>' is not assignable to type 'Promise<Customer[]>'.
So I have to cast it to through any to the actual Entity type it supposed to return:
.then(res => res.results (res.results as any) as Customer[])
Can we change this method signature to return an actual entity type instead of Entity?