Skip to content

Commit 20c3d1b

Browse files
committed
Fixed type guard for non-Typed instances (ethers-io#4087).
1 parent bb8685b commit 20c3d1b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src.ts/abi/typed.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,10 @@ export class Typed {
771771
* Returns true only if %%value%% is a [[Typed]] instance.
772772
*/
773773
static isTyped(value: any): value is Typed {
774-
return (value && value._typedSymbol === _typedSymbol);
774+
return (value
775+
&& typeof(value) === "object"
776+
&& "_typedSymbol" in value
777+
&& value._typedSymbol === _typedSymbol);
775778
}
776779

777780
/**

0 commit comments

Comments
 (0)