Skip to content

Commit d8f49fd

Browse files
committed
Update JSTypedArray.swift
1 parent e97e701 commit d8f49fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/JavaScriptKit/BasicObjects/JSTypedArray.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public class JSTypedArray<Element>: JSValueConvertible, ExpressibleByArrayLitera
3939
self.init(unsafe: jsObject)
4040
}
4141

42-
public init(objectRef jsObject: JSObjectRef) {
42+
public init?(objectRef jsObject: JSObjectRef) {
43+
guard jsObject.isInstanceOf(Element.typedArrayClass) else { return nil }
4344
_retain(jsObject.id)
4445
super.init(id: jsObject.id)
4546
}

0 commit comments

Comments
 (0)