We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec37bdf commit d361080Copy full SHA for d361080
Sources/JavaScriptKit/JSValueDecoder.swift
@@ -262,6 +262,10 @@ public class JSValueDecoder {
262
from value: JSValue,
263
userInfo: [CodingUserInfoKey: Any] = [:]
264
) throws -> T where T: Decodable {
265
+ if let jsType = T.self as? ConstructibleFromJSValue.Type {
266
+ let maybeValue = jsType.construct(from: value)
267
+ if let value = maybeValue { return value as! T }
268
+ }
269
let decoder = _Decoder(referencing: value, userInfo: userInfo)
270
return try T(from: decoder)
271
}
0 commit comments