Skip to content

Commit be1f916

Browse files
committed
Update JSTypedArray.swift
1 parent c07db3d commit be1f916

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: Sources/JavaScriptKit/BasicObjects/JSTypedArray.swift

+2-1
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)