Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit 7488434

Browse files
committed
Use boolean guards in assertion guards
1 parent 663f47a commit 7488434

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function isJsonRpcSuccess<T>(
3737
export function assertIsJsonRpcSuccess<T>(
3838
response: JsonRpcResponse<T>,
3939
): asserts response is JsonRpcSuccess<T> {
40-
if (!hasProperty(response, 'result')) {
40+
if (!isJsonRpcSuccess(response)) {
4141
throw new Error('Not a successful JSON-RPC response.');
4242
}
4343
}
@@ -69,7 +69,7 @@ export function isJsonRpcFailure(
6969
export function assertIsJsonRpcFailure(
7070
response: JsonRpcResponse<unknown>,
7171
): asserts response is JsonRpcFailure {
72-
if (!hasProperty(response, 'error')) {
72+
if (!isJsonRpcFailure(response)) {
7373
throw new Error('Not a failed JSON-RPC response.');
7474
}
7575
}

0 commit comments

Comments
 (0)