Skip to content

Commit 8c493be

Browse files
committed
Update JSTypedArray.swift
1 parent c60e192 commit 8c493be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/JavaScriptKit/JSTypedArray.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public class JSTypedArray<Element>: JSObjectRef, ExpressibleByArrayLiteral where
3030
super.init(id: jsObject.id)
3131
}
3232

33-
public init(objectRef jsObject: JSObjectRef) {
33+
public init?(objectRef jsObject: JSObjectRef) {
34+
guard jsObject.isInstanceOf(Element.typedArrayClass) else { return nil }
3435
_retain(jsObject.id)
3536
super.init(id: jsObject.id)
3637
}

0 commit comments

Comments
 (0)