Skip to content

Commit 182bb74

Browse files
authored
Merge pull request #9 from Wail-LT/fix/type/is-http-error
Fix of isHttpError function type
2 parents 36b313f + 5a3d6b6 commit 182bb74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/promise/HttpPromise.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function unwrapHttpPromise<T>(httpPromise: Promise<HttpResponse<T>>): Pro
5050
*
5151
* Returns `true` if the object seems to be a {@link HttpError}, else `false`.
5252
*/
53-
export function isHttpError(object: unknown) {
54-
return object && typeof object === 'object' && (object as HttpError).errorCode !== undefined;
53+
export function isHttpError(object: unknown): object is HttpError {
54+
return Boolean(object && typeof object === 'object' && (object as HttpError).errorCode !== undefined);
5555
}
5656

5757
function safeThen<P, R>(thenFunction: PromiseFunction<P, R>, debugContext?: object): PromiseFunction<P, R> {

0 commit comments

Comments
 (0)