Skip to content

Commit 000fe5b

Browse files
committed
More updates
1 parent fca7080 commit 000fe5b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Sources/JavaScriptKit/JSValueConvertible.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@ public protocol JSValueDecodable {
2929

3030
public typealias JSValueCodable = JSValueEncodable & JSValueDecodable
3131

32-
extension JSBridgedType {
33-
public static func canDecode(from jsValue: JSValue) -> Bool {
34-
jsValue.isInstanceOf(Self.classRef)
35-
}
36-
32+
extension JSAbstractBridgedType {
3733
public init(jsValue: JSValue) {
3834
self.init(objectRef: jsValue.object!)
3935
}
4036

4137
public func jsValue() -> JSValue {
42-
return JSValue.object(objectRef)
38+
.object(objectRef)
39+
}
40+
}
41+
42+
extension JSBridgedType {
43+
public static func canDecode(from jsValue: JSValue) -> Bool {
44+
jsValue.isInstanceOf(Self.classRef)
4345
}
4446
}
4547

Sources/JavaScriptKit/Support.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public struct AnyJSValueCodable: JSValueCodable, ExpressibleByNilLiteral {
217217
}
218218
}
219219

220-
public func staticCast<Type: JSBridgedType>(_ ref: JSBridgedType) -> Type {
220+
public func staticCast<Type: JSAbstractBridgedType>(_ ref: JSAbstractBridgedType) -> Type {
221221
return Type(objectRef: ref.objectRef)
222222
}
223223

0 commit comments

Comments
 (0)