-
Notifications
You must be signed in to change notification settings - Fork 4
Description
EntityManager.executeQuery() methods allows to pass ExecuteQuerySuccessCallback and ExecuteQueryErrorCallback. Their TS type definitions looks like:
export interface ExecuteQuerySuccessCallback {
(data: QueryResult): void;
}
export interface ExecuteQueryErrorCallback {
(error: { query: EntityQuery; httpResponse: HttpResponse; entityManager: EntityManager; message?: string; stack?:string }): void;
}
The issue is that type for ExecuteQueryErrorCallback's error parameter is defined 'ad-hoc', rather than creating a nicely named type like QueryResult.
At the same time, Breeze JS documentation describes errorCallback function parameter as:
Any error that occured wrapped into an Error object.
I can't find any Error TS type definition and have to define it in my code base like this:
import { EntityManager, EntityQuery, HttpResponse } from "breeze-client";
export interface IBreezeExecuteQueryError {
query: EntityQuery;
httpResponse: HttpResponse;
entityManager: EntityManager;
message ?: string;
stack ?: string
}
to be able to declare my error callbacks without ad-hoc type definitions:
return this.entityManager.executeQuery(query, successCallback, (error: IBreezeExecuteQueryError) => ...)
(Note, that my code style rules requires explicit parameter types declaration).
Can you add type definition for the error callback similar to IBreezeExecuteQueryError above?